Autopublish to npm on release creation #30
Workflow file for this run
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
name: Autopublish to npm on release creation | |
on: | |
release: | |
types: [published] | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.release.target_commitish }} | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
- run: npm i | |
- run: git config --global user.name "GitHub CD bot" | |
- run: git config --global user.email "[email protected]" | |
- run: npm version ${{ github.event.release.tag_name }} | |
- uses: JS-DevTools/npm-publish@v3 | |
with: | |
token: ${{ secrets.NPM_TOKEN }} | |
# use "beta" tag if relevant, otherwise use "latest" | |
tag: ${{ contains(github.event.release.tag_name, 'beta') && 'beta' || 'latest' }} | |
# push the version changes to GitHub | |
- run: git push | |
env: | |
github-token: ${{ secrets.GITHUB_TOKEN }} |