Skip to content

Commit 1c7d85f

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.
1 parent d2a395e commit 1c7d85f

17 files changed

+213
-706
lines changed

.github/workflows/build.yaml

Lines changed: 33 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -165,15 +165,17 @@ jobs:
165165
VERSION: 0.0.0
166166
VSCODE_TARGET: linux-x64
167167
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
168+
168169
steps:
169-
- uses: actions/checkout@v6
170-
with:
171-
submodules: true
172170
- run: sudo apt update && sudo apt install -y libkrb5-dev
173171
- uses: awalsh128/cache-apt-pkgs-action@2c09a5e66da6c8016428a2172bd76e5e4f14bb17 # latest
174172
with:
175173
packages: quilt
176174
version: 1.0
175+
176+
- uses: actions/checkout@v6
177+
with:
178+
submodules: true
177179
- run: quilt push -a
178180
- uses: actions/setup-node@v6
179181
with:
@@ -210,17 +212,17 @@ jobs:
210212
- run: tar -czf package.tar.gz release
211213
- uses: actions/upload-artifact@v7
212214
with:
213-
name: npm-package
215+
name: linux-x64-package
214216
path: ./package.tar.gz
215217

216218
test-e2e:
217219
name: Run e2e tests
218220
runs-on: ubuntu-22.04
219221
needs: [changes, build]
220222
if: needs.changes.outputs.code == 'true' || needs.changes.outputs.deps == 'true'
223+
221224
steps:
222225
- uses: actions/checkout@v6
223-
- run: sudo apt update && sudo apt install -y libkrb5-dev
224226
- uses: actions/setup-node@v6
225227
with:
226228
node-version-file: .node-version
@@ -229,21 +231,22 @@ jobs:
229231
package-lock.json
230232
test/package-lock.json
231233
- 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
236234
- name: Install Playwright OS dependencies
237235
run: |
238236
./test/node_modules/.bin/playwright install-deps
239237
./test/node_modules/.bin/playwright install
238+
239+
- uses: actions/download-artifact@v8
240+
with:
241+
name: linux-x64-package
242+
- run: tar -xzf package.tar.gz
243+
240244
- run: CODE_SERVER_TEST_ENTRY=./release npm run test:e2e
241245
- uses: actions/upload-artifact@v7
242246
if: always()
243247
with:
244248
name: failed-test-videos
245249
path: ./test/test-results
246-
- run: rm -rf ./release ./test/test-results
247250

248251
test-e2e-proxy:
249252
name: Run e2e tests behind proxy
@@ -252,9 +255,23 @@ jobs:
252255
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
253256
needs: [changes, build]
254257
if: needs.changes.outputs.code == 'true' || needs.changes.outputs.deps == 'true'
258+
255259
steps:
260+
- name: Cache Caddy
261+
uses: actions/cache@v4
262+
id: caddy-cache
263+
with:
264+
path: |
265+
~/.cache/caddy
266+
key: cache-caddy-2.5.2
267+
- name: Install Caddy
268+
if: steps.caddy-cache.outputs.cache-hit != 'true'
269+
run: |
270+
gh release download v2.5.2 --repo caddyserver/caddy --pattern "caddy_2.5.2_linux_amd64.tar.gz"
271+
mkdir -p ~/.cache/caddy
272+
tar -xzf caddy_2.5.2_linux_amd64.tar.gz --directory ~/.cache/caddy
273+
256274
- uses: actions/checkout@v6
257-
- run: sudo apt update && sudo apt install -y libkrb5-dev
258275
- uses: actions/setup-node@v6
259276
with:
260277
node-version-file: .node-version
@@ -263,32 +280,20 @@ jobs:
263280
package-lock.json
264281
test/package-lock.json
265282
- 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
270283
- name: Install Playwright OS dependencies
271284
run: |
272285
./test/node_modules/.bin/playwright install-deps
273286
./test/node_modules/.bin/playwright install
274-
- name: Cache Caddy
275-
uses: actions/cache@v4
276-
id: caddy-cache
287+
288+
- uses: actions/download-artifact@v8
277289
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
290+
name: linux-x64-package
291+
- run: tar -xzf package.tar.gz
292+
287293
- run: ~/.cache/caddy/caddy start --config ./ci/Caddyfile
288294
- run: CODE_SERVER_TEST_ENTRY=./release npm run test:e2e:proxy
289295
- run: ~/.cache/caddy/caddy stop --config ./ci/Caddyfile
290296
if: always()
291-
292297
- uses: actions/upload-artifact@v7
293298
if: always()
294299
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)