Publish Package to GitHub Packages #7
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 Package to GitHub Packages | |
on: | |
push: | |
branches: | |
- master | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 20.x | |
registry-url: 'https://npm.pkg.github.com' | |
scope: '@${{ github.repository_owner }}' | |
- name: Bump version | |
run: npm version patch | |
- name: Install dependencies | |
run: npm ci | |
- name: Run lint | |
run: npm run lint | |
- name: Run tests | |
run: npm test | |
- name: Build | |
run: npm run build | |
# - name: Publish to GitHub Packages | |
# run: npm publish | |
# env: | |
# NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Git config | |
run: | | |
git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
git config --global user.name "github-actions[bot]" | |
- name: Commit version bump | |
run: | | |
git add . | |
git commit -m 'ci: bump version' | |
git push | |
- name: Create Git tag | |
run: | | |
TAG_NAME=$(npm pkg get version | tr -d '"') | |
git tag v$TAG_NAME | |
git push origin v$TAG_NAME |