Skip to content

Autopublish

Autopublish #24

Workflow file for this run

# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
name: NPM Autopublish
run-name: Autopublish
on:
push:
branches:
- main
jobs:
test:
uses: ./.github/workflows/test.yml
publish-to-npm:
needs: [ test ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
- uses: actions/setup-node@v3
with:
node-version-file: .nvmrc
registry-url: https://registry.npmjs.org/
scope: "@kingstinct"
cache: pnpm
- run: git config user.name "$(git log -n 1 --pretty=format:%an)"
- run: git config user.email "$(git log -n 1 --pretty=format:%ae)"
- run: pnpm install --frozen-lockfile
- run: echo "versionTag=`npm version patch -m "%s - autorelease"`" >> $GITHUB_ENV
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
- run: git push --follow-tags --no-verify
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
- name: Release
uses: softprops/action-gh-release@v1
with:
name: ${{ env.versionTag }} - autorelease
tag_name: ${{ env.versionTag }}
generate_release_notes: true