Skip to content

fix(ci): correctly download npm/docker artifacts #4995

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Mar 17, 2022
1 change: 1 addition & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ jobs:
with:
fetch-depth: 0

- name: Download artifact
- uses: actions/download-artifact@v3
id: download
with:
Expand Down
13 changes: 13 additions & 0 deletions .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
9 changes: 8 additions & 1 deletion .github/workflows/npm-brew.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
9 changes: 9 additions & 0 deletions ci/build/release-github-assets.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand Down
9 changes: 3 additions & 6 deletions ci/steps/docker-buildx-push.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
8 changes: 0 additions & 8 deletions ci/steps/publish-npm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion docs/MAINTAINING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down