Skip to content

Commit

Permalink
Add dry run version for npm release
Browse files Browse the repository at this point in the history
  • Loading branch information
UX3D-haertl committed Sep 2, 2024
1 parent 3a97ac2 commit 0b11a7c
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/Publish_to_NPM.yml
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 }}
5 changes: 5 additions & 0 deletions RELEASE.md
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.

0 comments on commit 0b11a7c

Please sign in to comment.