Release 0.6.1 version #19
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: Publish | |
| on: | |
| push: | |
| tags: | |
| - '*' | |
| jobs: | |
| test: | |
| name: Run Tests | |
| uses: ./.github/workflows/test.yml | |
| build: | |
| name: Build JS safer | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Harden the runner | |
| uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1 | |
| with: | |
| egress-policy: block | |
| allowed-endpoints: > | |
| api.github.com:443 | |
| github.com:443 | |
| nodejs.org:443 | |
| release-assets.githubusercontent.com:443 | |
| objects.githubusercontent.com:443 | |
| registry.npmjs.org:443 | |
| - name: Checkout the repository | |
| uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| - name: Install pnpm | |
| uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0 | |
| with: | |
| version: 10 | |
| - name: Install Node.js | |
| uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0 | |
| with: | |
| node-version: 24 | |
| cache: pnpm | |
| - name: Install dependencies | |
| run: pnpm install --ignore-scripts | |
| - name: Run build | |
| run: pnpm build | |
| - name: Upload build artifacts | |
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 | |
| with: | |
| name: build-artifacts | |
| path: dist/ | |
| retention-days: 1 | |
| publish: | |
| name: Publish to npm | |
| needs: | |
| - test | |
| - build | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| id-token: write | |
| steps: | |
| - name: Harden the runner | |
| uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1 | |
| with: | |
| egress-policy: block | |
| allowed-endpoints: > | |
| api.github.com:443 | |
| github.com:443 | |
| release-assets.githubusercontent.com:443 | |
| registry.npmjs.org:443 | |
| *.sigstore.dev:443 | |
| - name: Checkout the repository | |
| uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| - name: Download build artifacts | |
| uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0 | |
| with: | |
| name: build-artifacts | |
| path: dist/ | |
| - name: Install npm | |
| uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0 | |
| with: | |
| node-version: 24 | |
| registry-url: 'https://registry.npmjs.org' | |
| - name: Publish to npm with provenance | |
| run: cd dist && npm publish --provenance --access public | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| release: | |
| name: Create GitHub Release | |
| needs: test | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Harden the runner | |
| uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1 | |
| with: | |
| egress-policy: block | |
| allowed-endpoints: > | |
| api.github.com:443 | |
| github.com:443 | |
| - name: Checkout the repository | |
| uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| - name: Extract the changelog | |
| id: changelog | |
| run: | | |
| TAG_NAME=${GITHUB_REF/refs\/tags\//} | |
| READ_SECTION=false | |
| CHANGELOG="" | |
| while IFS= read -r line; do | |
| if [[ "$line" =~ ^#+\ +(.*) ]]; then | |
| if [[ "${BASH_REMATCH[1]}" == "$TAG_NAME" ]]; then | |
| READ_SECTION=true | |
| elif [[ "$READ_SECTION" == true ]]; then | |
| break | |
| fi | |
| elif [[ "$READ_SECTION" == true ]]; then | |
| CHANGELOG+="$line"$'\n' | |
| fi | |
| done < "CHANGELOG.md" | |
| CHANGELOG=$(echo "$CHANGELOG" | awk '/./ {$1=$1;print}') | |
| echo "changelog_content<<EOF" >> $GITHUB_OUTPUT | |
| echo "$CHANGELOG" >> $GITHUB_OUTPUT | |
| echo "EOF" >> $GITHUB_OUTPUT | |
| - name: Create the release | |
| if: steps.changelog.outputs.changelog_content != '' | |
| uses: softprops/action-gh-release@6cbd405e2c4e67a21c47fa9e383d020e4e28b836 # v2.3.3 | |
| with: | |
| name: ${{ github.ref_name }} | |
| body: '${{ steps.changelog.outputs.changelog_content }}' | |
| draft: false | |
| prerelease: false |