Publish to NPM #24
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: Publish to NPM | |
defaults: | |
run: | |
shell: bash | |
on: | |
workflow_dispatch | |
jobs: | |
Publish: | |
if: contains('["raub"]', github.actor) | |
runs-on: ubuntu-latest | |
steps: | |
- name: Fetch Repository | |
uses: actions/checkout@v3 | |
with: | |
persist-credentials: false | |
- name: Install Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18.16.0 | |
cache: 'npm' | |
- name: Get Package Version | |
id: package-version | |
run: node -p "'version='+require('./package').version" >> $GITHUB_OUTPUT | |
- name: Publish | |
run: | | |
npm config set //registry.npmjs.org/:_authToken ${NPM_TOKEN} | |
npm publish --ignore-scripts | |
env: | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: Create Release | |
id: create_release | |
uses: softprops/action-gh-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ steps.package-version.outputs.version }} | |
name: Release ${{ steps.package-version.outputs.version }} | |
body: Published at ${{ github.sha }} |