Repository navigation
147 lines (130 loc) · 5.48 KB
/
Copy pathrelease.yml
File metadata and controls
147 lines (130 loc) · 5.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
name: release
on:
push:
branches:
- main
release:
types: [published]
workflow_dispatch:
inputs:
dryrun:
description: 'Run in dry-run mode (upload as artifact instead of release asset)'
required: true
type: boolean
default: false
permissions: {}
# Cancel in-progress runs for when multiple PRs get merged
# in quick succession. Ignore this for tag releases though.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ !contains(github.ref, 'tags/')}}
jobs:
build:
name: Build Coder Desktop
runs-on: ${{ github.repository_owner == 'coder' && 'depot-macos-26' || 'macos-26'}}
if: ${{ github.repository_owner == 'coder' }}
permissions:
# To upload assets to the release
contents: write
# for GCP auth
id-token: write
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
fetch-tags: true
persist-credentials: false
- name: Switch XCode Version
uses: maxim-lobanov/setup-xcode@ed7a3b1fda3918c0306d1b724322adc0b8cc0a90 # v1.7.0
with:
xcode-version: "26.5.0"
- name: Setup Nix
uses: ./.github/actions/nix-devshell
- name: Authenticate to Google Cloud
id: gcloud_auth
uses: google-github-actions/auth@7c6bc770dae815cd3e89ee6cdf493a5fab2cc093 # v3.0.0
with:
workload_identity_provider: ${{ secrets.GCP_WORKLOAD_ID_PROVIDER }}
service_account: ${{ secrets.GCP_SERVICE_ACCOUNT }}
token_format: "access_token"
- name: Setup GCloud SDK
uses: google-github-actions/setup-gcloud@aa5489c8933f4cc7a4f7d45035b3b1440c9c10db # v3.0.1
- name: Build
env:
APPLE_DEVELOPER_ID_PKCS12_B64: ${{ secrets.APPLE_DEVELOPER_ID_PKCS12_B64 }}
APPLE_DEVELOPER_ID_PKCS12_PASSWORD: ${{ secrets.APPLE_DEVELOPER_ID_PKCS12_PASSWORD }}
APPLE_INSTALLER_PKCS12_B64: ${{ secrets.APPLE_INSTALLER_PKCS12_B64 }}
APPLE_INSTALLER_PKCS12_PASSWORD: ${{ secrets.APPLE_INSTALLER_PKCS12_PASSWORD }}
APPLE_ID: ${{ secrets.APPLE_NOTARYTOOL_USERNAME }}
APPLE_ID_PASSWORD: ${{ secrets.APPLE_NOTARYTOOL_PASSWORD }}
APP_PROF: ${{ secrets.CODER_DESKTOP_APP_PROVISIONPROFILE_B64 }}
EXT_PROF: ${{ secrets.CODER_DESKTOP_EXTENSION_PROVISIONPROFILE_B64 }}
SPARKLE_PRIVATE_KEY: ${{ secrets.SPARKLE_PRIVATE_KEY }}
run: make release
# Upload as artifact in dry-run mode
- name: Upload Build Artifact
if: ${{ inputs.dryrun }}
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: coder-desktop-build
path: ${{ github.workspace }}/outputs/out
retention-days: 7
# Upload to release in non-dry-run mode
- name: Upload Release Assets
if: ${{ !inputs.dryrun }}
run: gh release upload "$RELEASE_TAG" "$out"/* --clobber
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_TAG: ${{ github.event_name == 'release' && github.event.release.tag_name || 'preview' }}
- name: Update Appcast
if: ${{ !inputs.dryrun }}
run: |
gsutil cp "gs://releases.coder.com/coder-desktop/mac/appcast.xml" ./oldappcast.xml
pushd scripts/update-appcast
swift run update-appcast \
-i ../../oldappcast.xml \
-s "$out"/Coder-Desktop.pkg.sig \
-v "$(../version.sh)" \
-o ../../appcast.xml \
-d "$VERSION_DESCRIPTION"
popd
gsutil -h "Cache-Control:no-cache,max-age=0" cp ./appcast.xml "gs://releases.coder.com/coder-desktop/mac/appcast.xml"
env:
VERSION_DESCRIPTION: ${{ (github.event_name == 'release' && github.event.release.body) || (github.event_name == 'push' && github.event.head_commit.message) || '' }}
update-cask:
name: Update homebrew-coder cask
runs-on: ${{ github.repository_owner == 'coder' && 'depot-macos-26' || 'macos-26'}}
if: ${{ github.repository_owner == 'coder' && github.event_name == 'release' }}
needs: build
# Holds the coder-package-publisher App key; release tags only, approved by a release manager.
environment: release-publish
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
fetch-tags: true
persist-credentials: false
- name: Setup Nix
uses: ./.github/actions/nix-devshell
- name: Generate coder-package-publisher App token
id: publisher_token
uses: actions/create-github-app-token@64ab729a6294000f5aa4a4bc0b73d1f32bc45510 # v3.3.0
with:
app-id: ${{ secrets.CODER_PACKAGE_PUBLISHER_APP_ID }}
private-key: ${{ secrets.CODER_PACKAGE_PUBLISHER_APP_PRIVATE_KEY }}
owner: coder
repositories: homebrew-coder
permission-contents: write
permission-pull-requests: write
- name: Update homebrew-coder
env:
GH_TOKEN: ${{ steps.publisher_token.outputs.token }}
RELEASE_TAG: ${{ github.event.release.tag_name }}
ASSIGNEE: ${{ github.actor }}
run: |
git config --global user.email "ci@coder.com"
git config --global user.name "Coder CI"
gh auth setup-git
./scripts/update-cask.sh --version "$RELEASE_TAG" --assignee "$ASSIGNEE"