This repository was archived by the owner on May 1, 2025. It is now read-only.
npm: bump v3.0.1 #6
Workflow file for this run
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: Release | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| jobs: | |
| build: | |
| uses: ./.github/workflows/build.yaml | |
| secrets: inherit | |
| publish: | |
| name: Publish to npmjs.org | |
| needs: [build] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup .npmrc | |
| run: cp tools/_.npmrc .npmrc | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: dist.tar | |
| - name: Unpack compilation artifact | |
| run: mkdir dist && tar -xf dist.tar -C dist | |
| - name: Configure the package.json for publishing | |
| run: jq --arg version "${REF#refs\/tags\/v}" 'del(.devDependencies,.scripts,.private) | .version=$version' package.json > dist/package.json | |
| env: | |
| REF: ${{ github.ref }} | |
| - name: Include README.md in the package | |
| run: cp README.md dist/ | |
| - name: Publish the package | |
| uses: docker://node:18.20.8-alpine3.21 | |
| with: | |
| args: yarn --cwd dist publish --no-git-tag-version | |
| env: | |
| NPM_TOKEN: ${{ secrets.NPM_TOKEN_RW }} | |
| - name: Update compilation artifact | |
| run: tar -cf ../dist-published.tar * | |
| working-directory: dist | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: dist-published.tar | |
| path: dist-published.tar | |
| retention-days: 1 | |
| create-release: | |
| name: Create GitHub Release | |
| needs: [publish] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Determine version | |
| id: version | |
| run: printf "tag=%s\n" "${REF#refs\/tags\/}" >> $GITHUB_OUTPUT | |
| env: | |
| REF: ${{ github.ref }} | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ steps.version.outputs.tag }} | |
| - name: Get release notes from tag | |
| id: tag-message | |
| run: | | |
| eof="$(openssl rand -hex 8)" | |
| printf "message<<%s\n%s\n%s\n" "$eof" "$(git tag -l --format='%(contents)' "${REF#refs\/tags\/}")" "$eof" >> $GITHUB_OUTPUT | |
| env: | |
| REF: ${{ github.ref }} | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: dist-published.tar | |
| - name: Compress release artifact | |
| run: gzip dist-published.tar && mv dist-published.tar.gz ${{ steps.version.outputs.tag }}.tar.gz | |
| - name: Create Release | |
| uses: ncipollo/release-action@v1 | |
| with: | |
| name: ${{ steps.version.outputs.tag }} | |
| body: ${{ steps.tag-message.outputs.message }} | |
| draft: false | |
| prerelease: false | |
| artifacts: ${{ steps.version.outputs.tag }}.tar.gz | |
| artifactErrorsFailBuild: true | |
| artifactContentType: application/gzip |