From 5afb26fb6076e52a76fe2780f2eab4769475d35e Mon Sep 17 00:00:00 2001 From: Joe Previte Date: Thu, 17 Mar 2022 11:52:39 -0700 Subject: [PATCH] fix(ci): correctly download npm/docker artifacts (#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 --- .github/workflows/ci.yaml | 3 ++- .github/workflows/docker.yaml | 13 +++++++++++++ .github/workflows/npm-brew.yaml | 9 ++++++++- ci/build/release-github-assets.sh | 9 +++++++++ ci/steps/docker-buildx-push.sh | 9 +++------ ci/steps/publish-npm.sh | 8 -------- docs/MAINTAINING.md | 2 +- 7 files changed, 36 insertions(+), 17 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 9b7450d23..32e2ead38 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -197,7 +197,8 @@ jobs: with: fetch-depth: 0 - - uses: actions/download-artifact@v3 + - name: Download artifact + uses: actions/download-artifact@v3 id: download with: name: "npm-package" diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml index 7cc0c1e27..d622e2c73 100644 --- a/.github/workflows/docker.yaml +++ b/.github/workflows/docker.yaml @@ -35,6 +35,19 @@ jobs: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} + - name: Get version + id: version + run: echo "::set-output name=version::$(jq .version package.json)" + + - name: Download artifact + uses: dawidd6/action-download-artifact@v2 + id: download + with: + branch: v${{ steps.version.outputs.version }} + workflow_conclusion: completed + name: "release-packages" + path: release-packages + - name: Run ./ci/steps/docker-buildx-push.sh run: ./ci/steps/docker-buildx-push.sh env: diff --git a/.github/workflows/npm-brew.yaml b/.github/workflows/npm-brew.yaml index 8c8b84fe2..785f427c4 100644 --- a/.github/workflows/npm-brew.yaml +++ b/.github/workflows/npm-brew.yaml @@ -23,9 +23,16 @@ jobs: steps: - uses: actions/checkout@v3 - - uses: actions/download-artifact@v3 + - name: Get version + id: version + run: echo "::set-output name=version::$(jq .version package.json)" + + - name: Download artifact + uses: dawidd6/action-download-artifact@v2 id: download with: + branch: v${{ steps.version.outputs.version }} + workflow_conclusion: completed name: "npm-package" path: release-npm-package diff --git a/ci/build/release-github-assets.sh b/ci/build/release-github-assets.sh index 29f275668..6395adcb7 100755 --- a/ci/build/release-github-assets.sh +++ b/ci/build/release-github-assets.sh @@ -9,6 +9,15 @@ set -euo pipefail main() { cd "$(dirname "$0")/../.." source ./ci/lib.sh + source ./ci/steps/steps-lib.sh + + # NOTE@jsjoeio - only needed if we use the download_artifact + # because we talk to the GitHub API. + # Needed to use GitHub API + if ! is_env_var_set "GITHUB_TOKEN"; then + echo "GITHUB_TOKEN is not set. Cannot download npm release-packages without GitHub credentials." + exit 1 + fi download_artifact release-packages ./release-packages local assets=(./release-packages/code-server*"$VERSION"*{.tar.gz,.deb,.rpm}) diff --git a/ci/steps/docker-buildx-push.sh b/ci/steps/docker-buildx-push.sh index c3bb05796..ba09cd76a 100755 --- a/ci/steps/docker-buildx-push.sh +++ b/ci/steps/docker-buildx-push.sh @@ -4,12 +4,9 @@ set -euo pipefail main() { cd "$(dirname "$0")/../.." - # ci/lib.sh sets VERSION and provides download_artifact here - source ./ci/lib.sh - - # Download the release-packages artifact - download_artifact release-packages ./release-packages - + # NOTE@jsjoeio - this script assumes that you've downloaded + # the release-packages artifact to ./release-packages before + # running this docker buildx step docker buildx bake -f ci/release-image/docker-bake.hcl --push } diff --git a/ci/steps/publish-npm.sh b/ci/steps/publish-npm.sh index b2d87e51e..36ca0773b 100755 --- a/ci/steps/publish-npm.sh +++ b/ci/steps/publish-npm.sh @@ -13,14 +13,6 @@ main() { exit 1 fi - # NOTE@jsjoeio - only needed if we use the download_artifact - # because we talk to the GitHub API. - # Needed to use GitHub API - if ! is_env_var_set "GITHUB_TOKEN"; then - echo "GITHUB_TOKEN is not set. Cannot download npm release artifact without GitHub credentials." - exit 1 - fi - ## Publishing Information # All the variables below are used to determine how we should publish # the npm package. We also use this information for bumping the version. diff --git a/docs/MAINTAINING.md b/docs/MAINTAINING.md index 7e0c0c248..07699ec25 100644 --- a/docs/MAINTAINING.md +++ b/docs/MAINTAINING.md @@ -164,7 +164,7 @@ If you're the current release manager, follow these steps: ### Publishing a release -1. Create a release branch called `v0.0.0` but replace with new version +1. Create a new branch called `v0.0.0` (replace 0s with actual version aka v4.1.0) 1. Run `yarn release:prep` and type in the new version (e.g., `3.8.1`) 1. GitHub Actions will generate the `npm-package`, `release-packages` and `release-images` artifacts. You do not have to wait for this step to complete