Skip to content

feat(ci): publish dev builds to @coder/code-server-pr #4972

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 14 commits into from
Mar 15, 2022
Merged
9 changes: 9 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,15 @@ jobs:
name: "npm-package"
path: release-npm-package

# NOTE@jsjoeio - we need to make sure we're using
# v7 or higher of the npm CLI because it's used
# in the yarn publish:npm script in development builds
# to modify package.json name.
- name: Install Node & npm v8
uses: actions/setup-node@v3
with:
node-version: "16.14.0"

- name: Run ./ci/steps/publish-npm.sh
run: yarn publish:npm
env:
Expand Down
6 changes: 6 additions & 0 deletions ci/steps/publish-npm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,15 @@ main() {
# Source: https://github.com/actions/checkout/issues/58#issuecomment-614041550
PR_NUMBER=$(echo "$GITHUB_REF" | awk 'BEGIN { FS = "/" } ; { print $3 }')
NPM_VERSION="$VERSION-$PR_NUMBER-$COMMIT_SHA"
DEV_PACKAGE_NAME="@coder/code-server-pr"
# This means the npm version will be tagged with "<pr number>"
# and installed when a user runs `yarn install code-server@<pr number>`
NPM_TAG="$PR_NUMBER"
# Use the development package name
# This is so we don't clutter the code-server versions on npm
# with development versions.
# NOTE: Requires npm Version 7.x or higher
npm pkg set name="$DEV_PACKAGE_NAME"
fi

echo "using tag: $NPM_TAG"
Expand Down