Publish Package #7
This file contains hidden or 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 | |
| on: | |
| release: | |
| types: [created] | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| - run: npm ci | |
| - name: Run tests | |
| run: npm run test:ci | |
| - name: Update package version | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| npm version patch | |
| git push --follow-tags | |
| publish-npm: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| registry-url: https://registry.npmjs.org/ | |
| scope: '@usrrname' | |
| - run: npm ci | |
| - name: Publish to NPM | |
| run: | | |
| npm config set registry https://npm.pkg.github.com/ --scope=@usrrname | |
| npm publish | |
| env: | |
| NODE_AUTH_TOKEN: ${{secrets.npm_token}} | |
| publish-gpr: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| registry-url: https://npm.pkg.github.com/ | |
| scope: '@usrrname' | |
| - run: npm ci | |
| - name: Publish to GitHub Packages | |
| run: | | |
| npm config set registry https://npm.pkg.github.com/ --scope=@usrrname | |
| npm publish | |
| env: | |
| NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} |