Skip to content

Commit 60c3fc8

Browse files
jsjoeioTinLe
authored andcommitted
fix(ci): correctly download npm/docker artifacts (coder#4995)
* fix(ci): correctly download npm artifact * fixup! fix(ci): correctly download npm artifact * docs: update MAINTAINING * fixup! docs: update MAINTAINING * fixup! Merge branch 'main' into 4949-chore-fix-npm-workflow * chore: get ci to run * refactor: use vVERSION branch name instead of release * refactor: use new download artifact in docker workflow * refactor: clean up release-github-assets script * fixup: remove extra v * fixup! fixup: remove extra v
1 parent 0c95596 commit 60c3fc8

File tree

7 files changed

+36
-17
lines changed

7 files changed

+36
-17
lines changed

.github/workflows/ci.yaml

+2-1
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,8 @@ jobs:
197197
with:
198198
fetch-depth: 0
199199

200-
- uses: actions/download-artifact@v3
200+
- name: Download artifact
201+
uses: actions/download-artifact@v3
201202
id: download
202203
with:
203204
name: "npm-package"

.github/workflows/docker.yaml

+13
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,19 @@ jobs:
3535
username: ${{ secrets.DOCKER_USERNAME }}
3636
password: ${{ secrets.DOCKER_PASSWORD }}
3737

38+
- name: Get version
39+
id: version
40+
run: echo "::set-output name=version::$(jq .version package.json)"
41+
42+
- name: Download artifact
43+
uses: dawidd6/action-download-artifact@v2
44+
id: download
45+
with:
46+
branch: v${{ steps.version.outputs.version }}
47+
workflow_conclusion: completed
48+
name: "release-packages"
49+
path: release-packages
50+
3851
- name: Run ./ci/steps/docker-buildx-push.sh
3952
run: ./ci/steps/docker-buildx-push.sh
4053
env:

.github/workflows/npm-brew.yaml

+8-1
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,16 @@ jobs:
2323
steps:
2424
- uses: actions/checkout@v3
2525

26-
- uses: actions/download-artifact@v3
26+
- name: Get version
27+
id: version
28+
run: echo "::set-output name=version::$(jq .version package.json)"
29+
30+
- name: Download artifact
31+
uses: dawidd6/action-download-artifact@v2
2732
id: download
2833
with:
34+
branch: v${{ steps.version.outputs.version }}
35+
workflow_conclusion: completed
2936
name: "npm-package"
3037
path: release-npm-package
3138

ci/build/release-github-assets.sh

+9
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,15 @@ set -euo pipefail
99
main() {
1010
cd "$(dirname "$0")/../.."
1111
source ./ci/lib.sh
12+
source ./ci/steps/steps-lib.sh
13+
14+
# NOTE@jsjoeio - only needed if we use the download_artifact
15+
# because we talk to the GitHub API.
16+
# Needed to use GitHub API
17+
if ! is_env_var_set "GITHUB_TOKEN"; then
18+
echo "GITHUB_TOKEN is not set. Cannot download npm release-packages without GitHub credentials."
19+
exit 1
20+
fi
1221

1322
download_artifact release-packages ./release-packages
1423
local assets=(./release-packages/code-server*"$VERSION"*{.tar.gz,.deb,.rpm})

ci/steps/docker-buildx-push.sh

+3-6
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,9 @@ set -euo pipefail
44
main() {
55
cd "$(dirname "$0")/../.."
66

7-
# ci/lib.sh sets VERSION and provides download_artifact here
8-
source ./ci/lib.sh
9-
10-
# Download the release-packages artifact
11-
download_artifact release-packages ./release-packages
12-
7+
# NOTE@jsjoeio - this script assumes that you've downloaded
8+
# the release-packages artifact to ./release-packages before
9+
# running this docker buildx step
1310
docker buildx bake -f ci/release-image/docker-bake.hcl --push
1411
}
1512

ci/steps/publish-npm.sh

-8
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,6 @@ main() {
1313
exit 1
1414
fi
1515

16-
# NOTE@jsjoeio - only needed if we use the download_artifact
17-
# because we talk to the GitHub API.
18-
# Needed to use GitHub API
19-
if ! is_env_var_set "GITHUB_TOKEN"; then
20-
echo "GITHUB_TOKEN is not set. Cannot download npm release artifact without GitHub credentials."
21-
exit 1
22-
fi
23-
2416
## Publishing Information
2517
# All the variables below are used to determine how we should publish
2618
# the npm package. We also use this information for bumping the version.

docs/MAINTAINING.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ If you're the current release manager, follow these steps:
164164

165165
### Publishing a release
166166

167-
1. Create a release branch called `v0.0.0` but replace with new version
167+
1. Create a new branch called `v0.0.0` (replace 0s with actual version aka v4.1.0)
168168
1. Run `yarn release:prep` and type in the new version (e.g., `3.8.1`)
169169
1. GitHub Actions will generate the `npm-package`, `release-packages` and
170170
`release-images` artifacts. You do not have to wait for this step to complete

0 commit comments

Comments
 (0)