Release #5559
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: | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| type: choice | |
| description: 'Release Version' | |
| required: true | |
| default: 'next' | |
| options: | |
| - latest | |
| - next | |
| branch: | |
| description: 'Release Branch (confirm release branch)' | |
| required: true | |
| default: 'main' | |
| permissions: | |
| id-token: write | |
| jobs: | |
| release: | |
| name: Release | |
| if: ${{ github.event_name == 'workflow_dispatch' || github.event_name == 'push' }} | |
| runs-on: ubuntu-latest | |
| environment: npm | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 25 | |
| ref: ${{ github.event.inputs.branch }} | |
| - name: Cache Tool Downloads | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cache | |
| key: ${{ runner.os }}-toolcache-${{ hashFiles('pnpm-lock.yaml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-toolcache- | |
| # Use corepack to install pnpm | |
| - name: Setup Pnpm | |
| run: | | |
| npm install -g corepack@latest --force | |
| corepack prepare pnpm@8.11.0 --activate | |
| corepack enable | |
| - name: Setup Node.js | |
| uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4 | |
| with: | |
| node-version: 22 | |
| # Update npm to the latest version to enable OIDC | |
| - name: Update npm | |
| run: | | |
| npm install -g npm@latest | |
| npm --version | |
| - name: Install deps | |
| run: pnpm install | |
| - name: Generate preview version | |
| if: github.event.inputs.version == 'next' | |
| run: | | |
| SAFE_BRANCH=$(echo "${{ github.ref_name }}" | sed 's/[^a-zA-Z0-9-]/-/g' | tr '[:upper:]' '[:lower:]') | |
| npx changeset version --snapshot "$SAFE_BRANCH" | |
| - name: Build and test Packages | |
| run: | | |
| git fetch origin main | |
| npx nx run-many --targets=build --projects=tag:type:pkg --skip-nx-cache | |
| npx nx run-many --targets=build --projects=tag:type:metro | |
| ls -l packages/*/dist packages/*/package.json | |
| - name: Publish latest version | |
| if: github.event.inputs.version == 'latest' | |
| run: | | |
| pnpm -r publish --tag ${{ github.event.inputs.version }} --publish-branch ${{ github.event.inputs.branch }} | |
| - name: Publish preview version | |
| if: github.event.inputs.version == 'next' | |
| run: | | |
| pnpm -r publish --tag next --no-git-checks |