-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3a97ac2
commit 0b11a7c
Showing
2 changed files
with
39 additions
and
0 deletions.
There are no files selected for viewing
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,34 @@ | ||
name: Publish to NPM (Dry run on prerelease) | ||
|
||
on: | ||
release: | ||
types: [prereleased, released] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Install Node.js | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: 12 | ||
|
||
- run: git config --global user.name "NPM release bot" | ||
- run: git config --global user.email "<>" | ||
|
||
- name: Install dependencies | ||
run: npm ci | ||
|
||
- name: Build | ||
run: npm run build | ||
|
||
- run: npm version ${{ github.event.release.tag_name }} | ||
|
||
- name: Publish to NPM | ||
if: ${{ github.event.action }} == 'prereleased' | ||
run: npm publish --dry-run | ||
env: | ||
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,5 @@ | ||
To test a release one can create a prerelease and it will run npm publish with the --dry-run argument. | ||
|
||
This was implemented with prereleases since github does currently not support workflow triggers for draft releases. ([Github discussion](https://github.com/orgs/community/discussions/7118)) | ||
|
||
Published normal releases automatically update the npm package. |