📦 Release @webref/[email protected] #1293
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
| # Publish a new package when a pre-release PR is merged. | |
| # | |
| # Job does nothing if PR that was merged is not a pre-release PR. | |
| name: "Publish @webref package if needed" | |
| permissions: | |
| # Required to create/update references (release tags), | |
| # includes "read", which is needed to retrieve a PR: | |
| # https://docs.github.com/en/rest/git/refs#create-a-reference--fine-grained-access-tokens | |
| # https://docs.github.com/en/rest/pulls/pulls#get-a-pull-request--fine-grained-access-tokens | |
| contents: write | |
| # Required for Open ID Connect (OIDC) authentication for npm publication: | |
| # https://docs.npmjs.com/trusted-publishers#github-actions-configuration | |
| id-token: write | |
| on: | |
| pull_request: | |
| branches: | |
| - main | |
| types: | |
| - closed | |
| jobs: | |
| release: | |
| if: startsWith(github.head_ref, 'release-') && github.event.pull_request.merged == true | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout latest version of release script | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: main | |
| - name: Setup node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Release package if needed | |
| run: node tools/release-package.js ${{ github.event.pull_request.number }} | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |