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: | |
| release: | |
| types: [published] | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| id-token: write # needed for provenance data generation | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| filter: tree:0 | |
| - uses: pnpm/action-setup@v2 | |
| with: | |
| version: 9 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| cache: 'pnpm' | |
| registry-url: 'https://registry.npmjs.org' | |
| - run: pnpm install --frozen-lockfile | |
| - name: Print Environment Info | |
| run: npx nx report | |
| shell: bash | |
| - name: Extract Project from GitHub Release Tag | |
| id: extract-project | |
| run: | | |
| RELEASE_TAG=${{ github.event.release.tag_name }} | |
| PROJECT_NAME=$(echo $RELEASE_TAG | sed -E 's/(.+)@v.*/\1/') | |
| echo "PROJECT_NAME=$PROJECT_NAME" >> $GITHUB_ENV | |
| echo "RELEASE_TAG=$RELEASE_TAG" >> $GITHUB_ENV | |
| echo "Project name: $PROJECT_NAME extracted from tag: $RELEASE_TAG" | |
| shell: bash | |
| - name: Determine if Prerelease | |
| id: check-prerelease | |
| run: | | |
| IS_PRERELEASE=${{ github.event.release.prerelease }} | |
| NPM_TAG="latest" | |
| if [ "$IS_PRERELEASE" = "true" ]; then | |
| NPM_TAG="next" | |
| fi | |
| echo "NPM_TAG=$NPM_TAG" >> $GITHUB_ENV | |
| echo "Publishing with NPM tag: $NPM_TAG" | |
| shell: bash | |
| - name: Build | |
| run: pnpm exec nx build ${{ env.PROJECT_NAME }} | |
| shell: bash | |
| - name: Publish Package | |
| shell: bash | |
| run: pnpm exec nx release publish --projects=${{ env.PROJECT_NAME }} --tag=${{ env.NPM_TAG }} | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| NPM_CONFIG_PROVENANCE: true | |
| # This is needed for actions/setup-node authentication to work | |
| npm_config_registry: https://registry.npmjs.org | |