Publishing canary for @nylas/react to production by @AaronDDM #2
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 snapshot | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| packages: | |
| required: true | |
| description: "The packages to publish (e.g. @nylas/connect, @nylas/react)" | |
| type: choice | |
| options: | |
| - "@nylas/connect" | |
| - "@nylas/react" | |
| snapshot_tag: | |
| description: "Snapshot tag (e.g., alpha, beta, canary, dev)" | |
| required: true | |
| default: "canary" | |
| type: choice | |
| options: | |
| - "canary" | |
| - "alpha" | |
| - "beta" | |
| - "snapshot" | |
| - "dev" | |
| environment: | |
| required: true | |
| type: choice | |
| options: | |
| - "staging" | |
| - "production" | |
| default: "production" | |
| description: "The environment to publish to (staging or production)" | |
| run-name: "Publishing ${{ inputs.snapshot_tag }} for ${{ inputs.packages }} to ${{ inputs.environment }} by @${{ github.actor }}" | |
| env: | |
| NODE_VERSION: ${{ vars.NODE_VERSION }} | |
| IS_CI: true | |
| permissions: | |
| contents: read | |
| id-token: write # needed for provenance data generation | |
| jobs: | |
| publish-snapshot: | |
| runs-on: blacksmith-2vcpu-ubuntu-2404 | |
| environment: ${{ inputs.environment }} | |
| steps: | |
| # Checkout the repo | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| # Setup Node.js and pnpm | |
| - uses: pnpm/action-setup@v4 | |
| with: | |
| run_install: false | |
| - name: Install Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: pnpm | |
| registry-url: "https://registry.npmjs.org" | |
| # Install dependencies | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| # Create snapshot version | |
| - name: Create snapshot version | |
| run: pnpm changeset version --snapshot ${{ inputs.snapshot_tag }} && pnpm -r generate:version && git add --all | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.BOT_PAT }} | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| # Build packages | |
| - name: Build packages | |
| run: pnpm nx run-many -t build --parallel=3 --projects=${{ inputs.packages }} | |
| env: | |
| IMAGE_TAG: ${{ inputs.snapshot_tag }} | |
| # Publish snapshot to npm and output release tags to $GITHUB_STEP_SUMMARY | |
| - name: Publish snapshot | |
| run: | | |
| # Publish packages and capture output | |
| pnpm changeset publish --no-git-tag --snapshot --tag ${{ inputs.snapshot_tag }} | tee /tmp/changeset_publish.log | |
| # Add formatted output to GitHub step summary | |
| echo '### 📦 Published Snapshot Packages' >> $GITHUB_STEP_SUMMARY | |
| echo '' >> $GITHUB_STEP_SUMMARY | |
| # Extract and display only the published package versions | |
| grep -Eo '🦋[[:space:]]+(@nylas/(connect|react)@[0-9]+\.[0-9]+\.[0-9]+-[a-zA-Z0-9]+)' /tmp/changeset_publish.log | \ | |
| sed 's/🦋[[:space:]]\+/- /' >> $GITHUB_STEP_SUMMARY || echo '- No packages published' >> $GITHUB_STEP_SUMMARY | |
| # Optionally add full log in a collapsible section | |
| echo '' >> $GITHUB_STEP_SUMMARY | |
| echo '<details><summary>📋 Full publish log</summary>' >> $GITHUB_STEP_SUMMARY | |
| echo '' >> $GITHUB_STEP_SUMMARY | |
| echo '```' >> $GITHUB_STEP_SUMMARY | |
| cat /tmp/changeset_publish.log >> $GITHUB_STEP_SUMMARY | |
| echo '```' >> $GITHUB_STEP_SUMMARY | |
| echo '</details>' >> $GITHUB_STEP_SUMMARY | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.BOT_PAT }} | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |