Skip to content

refactor(ci): clean up npm workflows #4786

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 2 commits into from
Jan 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -177,15 +177,6 @@ jobs:
name: npm-package
path: ./package.tar.gz

- name: Publish npm package with PR number and commit SHA
run: yarn publish:npm
env:
ENVIRONMENT: "development"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_TAG: ${{ github.event.number }}
PR_NUMBER_AND_COMMIT_SHA: ${{ github.event.number }}-${{ github.event.pull_request.head.sha }}

# TODO: cache building yarn --production
# possibly 2m30s of savings(?)
# this requires refactoring our release scripts
Expand Down
29 changes: 29 additions & 0 deletions .github/workflows/npm-beta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Publish on npm and tag with "beta"

on:
# Shows the manual trigger in GitHub UI
# helpful as a back-up in case the GitHub Actions Workflow fails
workflow_dispatch:

push:
branches:
- main

jobs:
# NOTE: this job requires curl, jq and yarn
# All of them are included in ubuntu-latest.
npm:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Publish npm package and tag "beta"
run: yarn publish:npm
env:
ENVIRONMENT: "staging"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_TAG: "beta"
# Since this only runs on a merge into main, we can't use github.event.number
# so we instead use the word "beta" and the PR merge commit SHA
PR_NUMBER_AND_COMMIT_SHA: beta-${{ github.sha }}
2 changes: 1 addition & 1 deletion .github/workflows/npm-brew.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: Publish npm package with PR number and commit SHA
- name: Publish npm package and tag with "latest"
run: yarn publish:npm
env:
ENVIRONMENT: "production"
Expand Down
15 changes: 8 additions & 7 deletions .github/workflows/npm-dev.yaml
Original file line number Diff line number Diff line change
@@ -1,29 +1,30 @@
name: Publish on npm and tag with "beta"
name: Publish on npm and tag with PR number

on:
# Shows the manual trigger in GitHub UI
# helpful as a back-up in case the GitHub Actions Workflow fails
workflow_dispatch:

push:
pull_request:
branches:
- main

jobs:
# NOTE: this job requires curl, jq and yarn
# All of them are included in ubuntu-latest.
npm:
# This environment "npm" requires someone from
# coder/code-server-reviewers to approve the PR before this job runs.
environment: npm
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Run ./ci/steps/publish-npm.sh
run: yarn publish:npm
env:
ENVIRONMENT: "staging"
ENVIRONMENT: "development"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_TAG: "beta"
# Since this only runs on a merge into main, we can't use github.event.number
# so we instead use the word "beta" and the PR merge commit SHA
PR_NUMBER_AND_COMMIT_SHA: beta-${{ github.sha }}
NPM_TAG: ${{ github.event.number }}
PR_NUMBER_AND_COMMIT_SHA: ${{ github.event.number }}-${{ github.event.pull_request.head.sha }}