-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add GitHub actions for automated NPM release
Build, tests, and release via GitHub. NPM_TOKEN is stored as a secret, and scoped to @cloudflare/voprf-ts.
- Loading branch information
Showing
3 changed files
with
76 additions
and
29 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: Release | ||
|
||
on: | ||
release: | ||
types: | ||
- published | ||
|
||
jobs: | ||
release: | ||
if: ${{ github.repository_owner == 'cloudflare' }} | ||
name: Publishing to npmjs registry | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checking out | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Use Node.js 20 | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 20 | ||
cache: 'npm' | ||
|
||
- name: Install NPM dependencies | ||
run: npm ci | ||
|
||
- name: Check build | ||
run: npm run build | ||
|
||
- name: Publish to npmjs | ||
run: npm publish | ||
env: | ||
# To create a new token, go to https://www.npmjs.com/settings/<user>/tokens/, generate a "Granular Access Token" scoped to @cloudflare/voprf-ts, and update NPM_TOKEN GitHub secret | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: Tests | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
testing: | ||
name: Testing on Node v${{ matrix.node }} | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
node: [20, 18] | ||
steps: | ||
- name: Checking out | ||
uses: actions/checkout@v3 | ||
|
||
- name: Use Node.js v${{ matrix.node }} | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node }} | ||
cache: 'npm' | ||
|
||
- name: Install NPM dependencies | ||
run: npm ci | ||
|
||
- name: Check lint | ||
run: npm run lint | ||
|
||
- name: Check build | ||
run: npm run build | ||
|
||
- name: Run NPM tests | ||
run: npm test | ||
|
||
- name: Check examples | ||
run: npm run examples |