Version Packages (rc) (#64) #59
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: Version & Publish Packages | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| release_type: | |
| description: 'Choose which release pipeline to run' | |
| required: false | |
| default: regular | |
| type: choice | |
| options: | |
| - regular | |
| - canary | |
| push: | |
| branches: | |
| - main | |
| env: | |
| DO_NOT_TRACK: '1' | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| id-token: write | |
| jobs: | |
| build-and-publish-to-npm: | |
| runs-on: ubuntu-latest | |
| env: | |
| RELEASE_TYPE: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.release_type || 'regular' }} | |
| NPM_CONFIG_PROVENANCE: true | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Install Dependencies | |
| uses: ./.github/workflows/actions/install-dependencies | |
| - name: Lint | |
| run: pnpm lint | |
| - name: Test | |
| run: pnpm test | |
| - name: Build | |
| run: pnpm build | |
| - name: Create Changesets Pull Request or Trigger an npm Publish | |
| if: env.RELEASE_TYPE == 'regular' | |
| id: changesets | |
| uses: changesets/action@v1 | |
| with: | |
| createGithubReleases: true | |
| env: | |
| HUSKY: '0' | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Choose final step | |
| if: env.RELEASE_TYPE == 'regular' | |
| id: build-step-decider | |
| run: | | |
| echo "step-name=${{ steps.changesets.outputs.hasChangesets == 'false' && 'publish-packages' || 'build' }}" >> "$GITHUB_OUTPUT" | |
| - name: Run final step | |
| if: env.RELEASE_TYPE == 'regular' | |
| run: pnpm ${{ steps.build-step-decider.outputs.step-name }} | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Publish Canary Snapshot | |
| if: env.RELEASE_TYPE == 'canary' | |
| run: | | |
| pnpm changeset version --snapshot canary | |
| pnpm build | |
| pnpm changeset publish --tag canary --filter @solana/client --filter @solana/react-hooks --filter @solana/web3-compat | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |