Skip to content

Commit aef2d19

Browse files
committed
Refactor releases to use VS Code packaging
Instead of building the linux-x64 package, stripping the modules, then installing them again, we build the correct target and use the modules as they are. This means we do not have to copy all the post-processing steps like the ones that delete unnecessary modules. For the NPM package we still publish the linux-x64 package (without modules of course). This means npm installations do not get that same post-processing. Another advantage of this is that we can run the release immediately without having to wait for the build step, or on a commit that no longer has a build artifact, since they all build individually now. We could try sharing the core-ci build step, but leaving that alone for now. I also converted the macOS jobs into a matrix. Deleted the CI readme because it was out of date and seemed to just repeat what should be described in the scripts anyway. Removed a section about Homebrew since we do not maintain that anymore.
1 parent d2a395e commit aef2d19

17 files changed

+223
-728
lines changed

.github/workflows/build.yaml

Lines changed: 38 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,6 @@ concurrency:
1515
group: ${{ github.workflow }}-${{ github.ref }}
1616
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
1717

18-
# Note: if: success() is used in several jobs -
19-
# this ensures that it only executes if all previous jobs succeeded.
20-
21-
# if: steps.cache-node-modules.outputs.cache-hit != 'true'
22-
# will skip running `npm install` if it successfully fetched from cache
23-
2418
jobs:
2519
changes:
2620
runs-on: ubuntu-latest
@@ -31,10 +25,8 @@ jobs:
3125
docs: ${{ steps.filter.outputs.docs }}
3226
helm: ${{ steps.filter.outputs.helm }}
3327
steps:
34-
- name: Checkout repo
35-
uses: actions/checkout@v6
36-
- name: Check changed files
37-
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3
28+
- uses: actions/checkout@v6
29+
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3
3830
id: filter
3931
with:
4032
filters: |
@@ -157,23 +149,25 @@ jobs:
157149
token: ${{ secrets.CODECOV_TOKEN }}
158150

159151
build:
160-
name: Build code-server linux-x64 package
152+
name: linux-x64
161153
runs-on: ubuntu-22.04
162154
env:
163155
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
164156
DISABLE_V8_COMPILE_CACHE: 1
165157
VERSION: 0.0.0
166158
VSCODE_TARGET: linux-x64
167159
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
160+
168161
steps:
169-
- uses: actions/checkout@v6
170-
with:
171-
submodules: true
172162
- run: sudo apt update && sudo apt install -y libkrb5-dev
173163
- uses: awalsh128/cache-apt-pkgs-action@2c09a5e66da6c8016428a2172bd76e5e4f14bb17 # latest
174164
with:
175165
packages: quilt
176166
version: 1.0
167+
168+
- uses: actions/checkout@v6
169+
with:
170+
submodules: true
177171
- run: quilt push -a
178172
- uses: actions/setup-node@v6
179173
with:
@@ -210,17 +204,17 @@ jobs:
210204
- run: tar -czf package.tar.gz release
211205
- uses: actions/upload-artifact@v7
212206
with:
213-
name: npm-package
207+
name: linux-x64-package
214208
path: ./package.tar.gz
215209

216210
test-e2e:
217211
name: Run e2e tests
218212
runs-on: ubuntu-22.04
219213
needs: [changes, build]
220-
if: needs.changes.outputs.code == 'true' || needs.changes.outputs.deps == 'true'
214+
if: needs.changes.outputs.code == 'true' || needs.changes.outputs.deps == 'true' || needs.changes.outputs.ci == 'true'
215+
221216
steps:
222217
- uses: actions/checkout@v6
223-
- run: sudo apt update && sudo apt install -y libkrb5-dev
224218
- uses: actions/setup-node@v6
225219
with:
226220
node-version-file: .node-version
@@ -229,32 +223,47 @@ jobs:
229223
package-lock.json
230224
test/package-lock.json
231225
- run: SKIP_SUBMODULE_DEPS=1 npm ci
232-
- uses: actions/download-artifact@v8
233-
with:
234-
name: npm-package
235-
- run: tar -xzf package.tar.gz
236226
- name: Install Playwright OS dependencies
237227
run: |
238228
./test/node_modules/.bin/playwright install-deps
239229
./test/node_modules/.bin/playwright install
230+
231+
- uses: actions/download-artifact@v8
232+
with:
233+
name: linux-x64-package
234+
- run: tar -xzf package.tar.gz
235+
240236
- run: CODE_SERVER_TEST_ENTRY=./release npm run test:e2e
241237
- uses: actions/upload-artifact@v7
242238
if: always()
243239
with:
244240
name: failed-test-videos
245241
path: ./test/test-results
246-
- run: rm -rf ./release ./test/test-results
247242

248243
test-e2e-proxy:
249244
name: Run e2e tests behind proxy
250245
runs-on: ubuntu-22.04
251246
env:
252247
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
253248
needs: [changes, build]
254-
if: needs.changes.outputs.code == 'true' || needs.changes.outputs.deps == 'true'
249+
if: needs.changes.outputs.code == 'true' || needs.changes.outputs.deps == 'true' || needs.changes.outputs.ci == 'true'
250+
255251
steps:
252+
- name: Cache Caddy
253+
uses: actions/cache@v4
254+
id: caddy-cache
255+
with:
256+
path: |
257+
~/.cache/caddy
258+
key: cache-caddy-2.5.2
259+
- name: Install Caddy
260+
if: steps.caddy-cache.outputs.cache-hit != 'true'
261+
run: |
262+
gh release download v2.5.2 --repo caddyserver/caddy --pattern "caddy_2.5.2_linux_amd64.tar.gz"
263+
mkdir -p ~/.cache/caddy
264+
tar -xzf caddy_2.5.2_linux_amd64.tar.gz --directory ~/.cache/caddy
265+
256266
- uses: actions/checkout@v6
257-
- run: sudo apt update && sudo apt install -y libkrb5-dev
258267
- uses: actions/setup-node@v6
259268
with:
260269
node-version-file: .node-version
@@ -263,32 +272,20 @@ jobs:
263272
package-lock.json
264273
test/package-lock.json
265274
- run: SKIP_SUBMODULE_DEPS=1 npm ci
266-
- uses: actions/download-artifact@v8
267-
with:
268-
name: npm-package
269-
- run: tar -xzf package.tar.gz
270275
- name: Install Playwright OS dependencies
271276
run: |
272277
./test/node_modules/.bin/playwright install-deps
273278
./test/node_modules/.bin/playwright install
274-
- name: Cache Caddy
275-
uses: actions/cache@v4
276-
id: caddy-cache
279+
280+
- uses: actions/download-artifact@v8
277281
with:
278-
path: |
279-
~/.cache/caddy
280-
key: cache-caddy-2.5.2
281-
- name: Install Caddy
282-
if: steps.caddy-cache.outputs.cache-hit != 'true'
283-
run: |
284-
gh release download v2.5.2 --repo caddyserver/caddy --pattern "caddy_2.5.2_linux_amd64.tar.gz"
285-
mkdir -p ~/.cache/caddy
286-
tar -xzf caddy_2.5.2_linux_amd64.tar.gz --directory ~/.cache/caddy
282+
name: linux-x64-package
283+
- run: tar -xzf package.tar.gz
284+
287285
- run: ~/.cache/caddy/caddy start --config ./ci/Caddyfile
288286
- run: CODE_SERVER_TEST_ENTRY=./release npm run test:e2e:proxy
289287
- run: ~/.cache/caddy/caddy stop --config ./ci/Caddyfile
290288
if: always()
291-
292289
- uses: actions/upload-artifact@v7
293290
if: always()
294291
with:

.github/workflows/publish.yaml

Lines changed: 35 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ on:
66
workflow_dispatch:
77
inputs:
88
version:
9-
description: The version to publish (include "v", i.e. "v4.9.1").
109
type: string
1110
required: true
1211

@@ -23,50 +22,45 @@ concurrency:
2322
jobs:
2423
npm:
2524
runs-on: ubuntu-latest
25+
env:
26+
TAG: ${{ inputs.version || github.ref_name }}
27+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
28+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
29+
NPM_ENVIRONMENT: "production"
30+
2631
steps:
27-
- name: Checkout code-server
28-
uses: actions/checkout@v6
32+
- name: Set version to tag without leading v
33+
run: |
34+
echo "VERSION=${TAG#v}" >> $GITHUB_ENV
2935
30-
- name: Install Node.js
31-
uses: actions/setup-node@v6
36+
- uses: actions/checkout@v6
37+
- uses: actions/setup-node@v6
3238
with:
3339
node-version-file: .node-version
3440

35-
- name: Download npm package from release artifacts
36-
uses: robinraju/release-downloader@daf26c55d821e836577a15f77d86ddc078948b05 # v1.12
41+
- uses: robinraju/release-downloader@daf26c55d821e836577a15f77d86ddc078948b05 # v1.12
3742
with:
3843
repository: "coder/code-server"
3944
tag: ${{ inputs.version || github.ref_name }}
4045
fileName: "package.tar.gz"
4146
out-file-path: "release-npm-package"
4247

43-
# Strip out the v (v4.9.1 -> 4.9.1).
44-
- name: Get and set VERSION
45-
run: |
46-
echo "VERSION=${TAG#v}" >> $GITHUB_ENV
47-
48-
env:
49-
TAG: ${{ inputs.version || github.ref_name }}
50-
- run: npm run publish:npm
51-
env:
52-
VERSION: ${{ env.VERSION }}
53-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
54-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
55-
NPM_ENVIRONMENT: "production"
48+
- run: tar -xzf release-npm-package/package.tar.gz
49+
- run: |
50+
pushd release
51+
npm publish --access public
5652
5753
aur:
5854
runs-on: ubuntu-latest
5955
timeout-minutes: 10
6056
env:
6157
GH_TOKEN: ${{ secrets.HOMEBREW_GITHUB_API_TOKEN }}
58+
TAG: ${{ inputs.version || github.ref_name }}
6259

6360
steps:
64-
# We need to checkout code-server so we can get the version
65-
- name: Checkout code-server
66-
uses: actions/checkout@v6
67-
with:
68-
fetch-depth: 0
69-
path: "./code-server"
61+
- name: Set version to tag without leading v
62+
run: |
63+
echo "VERSION=${TAG#v}" >> $GITHUB_ENV
7064
7165
- name: Checkout code-server-aur repo
7266
uses: actions/checkout@v6
@@ -86,27 +80,14 @@ jobs:
8680
git config --global user.name cdrci
8781
git config --global user.email opensource@coder.com
8882
89-
# Strip out the v (v4.9.1 -> 4.9.1).
90-
- name: Get and set VERSION
91-
run: |
92-
echo "VERSION=${TAG#v}" >> $GITHUB_ENV
93-
94-
env:
95-
TAG: ${{ inputs.version || github.ref_name }}
9683
- name: Validate package
9784
uses: heyhusen/archlinux-package-action@c9f94059ccbebe8710d31d582f33ef4e84fe575c # v3.0.0
98-
env:
99-
VERSION: ${{ env.VERSION }}
10085
with:
10186
pkgver: ${{ env.VERSION }}
10287
updpkgsums: true
10388
srcinfo: true
10489

10590
- name: Open PR
106-
# We need to git push -u otherwise gh will prompt
107-
# asking where to push the branch.
108-
env:
109-
VERSION: ${{ env.VERSION }}
11091
run: |
11192
git checkout -b update-version-${{ env.VERSION }}
11293
git add .
@@ -116,54 +97,40 @@ jobs:
11697
11798
docker:
11899
runs-on: ubuntu-latest
119-
steps:
120-
- name: Checkout code-server
121-
uses: actions/checkout@v6
100+
env:
101+
GITHUB_TOKEN: ${{ github.token }}
102+
TAG: ${{ inputs.version || github.ref_name }}
122103

123-
- name: Set up QEMU
124-
uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3
104+
steps:
105+
- name: Set version to tag without leading v
106+
run: |
107+
echo "VERSION=${TAG#v}" >> $GITHUB_ENV
125108
126-
- name: Set up Docker Buildx
127-
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3
109+
- uses: actions/checkout@v6
110+
- uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3
111+
- uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3
128112

129-
- name: Login to Docker Hub
130-
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3
113+
- uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3
131114
with:
132115
username: ${{ secrets.DOCKER_USERNAME }}
133116
password: ${{ secrets.DOCKER_PASSWORD }}
134-
135-
- name: Login to GHCR
136-
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3
117+
- uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3
137118
with:
138119
registry: ghcr.io
139120
username: ${{ github.actor }}
140121
password: ${{ secrets.GITHUB_TOKEN }}
141122

142-
# Strip out the v (v4.9.1 -> 4.9.1).
143-
- name: Get and set VERSION
144-
run: |
145-
echo "VERSION=${TAG#v}" >> $GITHUB_ENV
146-
147-
env:
148-
TAG: ${{ inputs.version || github.ref_name }}
149-
- name: Download deb artifacts
150-
uses: robinraju/release-downloader@daf26c55d821e836577a15f77d86ddc078948b05 # v1.12
123+
- uses: robinraju/release-downloader@daf26c55d821e836577a15f77d86ddc078948b05 # v1.12
151124
with:
152125
repository: "coder/code-server"
153126
tag: v${{ env.VERSION }}
154127
fileName: "*.deb"
155128
out-file-path: "release-packages"
156-
157-
- name: Download rpm artifacts
158-
uses: robinraju/release-downloader@daf26c55d821e836577a15f77d86ddc078948b05 # v1.12
129+
- uses: robinraju/release-downloader@daf26c55d821e836577a15f77d86ddc078948b05 # v1.12
159130
with:
160131
repository: "coder/code-server"
161132
tag: v${{ env.VERSION }}
162133
fileName: "*.rpm"
163134
out-file-path: "release-packages"
164135

165-
- name: Publish to Docker
166-
run: ./ci/steps/docker-buildx-push.sh
167-
env:
168-
VERSION: ${{ env.VERSION }}
169-
GITHUB_TOKEN: ${{ github.token }}
136+
- run: npm run publish:docker

0 commit comments

Comments
 (0)