chore: tag and release version #60
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: Release and Publish to NPM | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
publish: | |
name: Publish | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [18.x] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
registry-url: "https://registry.npmjs.org" | |
- name: Install dependencies | |
run: | | |
npm cache clean --force | |
rm -rf node_modules package-lock.json | |
npm install | |
- name: Lint | |
run: npm run lint | |
# - name: Publish to npm | |
# id: publish_to_npm | |
# run: npm publish --access public --registry=https://registry.npmjs.org/ --tag latest --npm-token=${{ secrets.NPM_TOKEN }} | |
# env: | |
# NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: Setup Git | |
run: | | |
git config --global user.name "GitHub Actions" | |
git config --global user.email "github-actions@users.noreply.github.com" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GH_PAT }} | |
- name: Extract version | |
# if: steps.publish_to_npm.outcome == 'success' | |
id: extract_version | |
uses: Saionaro/extract-package-version@v1.2.1 | |
- name: Create and Release Tag | |
run: | | |
git tag v${{ steps.extract_version.outputs.version }} | |
git push origin v${{ steps.extract_version.outputs.version }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GH_PAT }} |