Merge pull request #507 from ForgeRock/update-protect-readme #355
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 | |
| on: | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| inputs: | |
| branch: | |
| description: 'Branch/ref to publish from' | |
| required: false | |
| default: 'main' | |
| type: string | |
| dist_tag: | |
| description: 'npm dist-tag' | |
| required: false | |
| default: 'beta' | |
| type: string | |
| prerelease: | |
| description: 'changesets prerelease tag (beta/canary)' | |
| required: false | |
| default: 'beta' | |
| type: string | |
| access: | |
| description: 'npm access' | |
| required: false | |
| default: 'public' | |
| type: string | |
| env: | |
| NX_CLOUD_ENCRYPTION_KEY: ${{ secrets.NX_CLOUD_ENCRYPTION_KEY }} | |
| NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }} | |
| PNPM_CACHE_FOLDER: .pnpm-store | |
| CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
| CI: true | |
| jobs: | |
| publish-or-pr: | |
| if: github.event_name == 'push' | |
| permissions: | |
| contents: write | |
| issues: write | |
| pull-requests: write | |
| id-token: write | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| token: ${{ secrets.GH_TOKEN }} | |
| - name: Setup Project | |
| uses: ./.github/actions/setup | |
| with: | |
| CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
| - run: npm install npm@latest -g | |
| - run: npm --version | |
| - name: publish | |
| uses: changesets/action@v1 | |
| id: changesets | |
| with: | |
| publish: pnpm ci:release | |
| version: pnpm ci:version | |
| title: Release PR | |
| branch: main | |
| commit: 'chore: version-packages' | |
| setupGitUser: true | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} | |
| - name: Publish Release Steps | |
| if: steps.changesets.outputs.published == 'true' | |
| uses: ./.github/actions/publish-release | |
| with: | |
| publishedPackages: ${{ steps.changesets.outputs.publishedPackages }} | |
| slackWebhook: ${{ secrets.SLACK_WEBHOOK_URL }} | |
| - name: Publish Beta Steps | |
| if: steps.changesets.outputs.published == 'false' | |
| uses: ./.github/actions/publish-beta | |
| - name: Calculate baseline bundle sizes | |
| run: | | |
| chmod +x ./scripts/bundle-sizes.sh | |
| rm -f previous_sizes.json | |
| echo "📊 Calculating fresh baseline bundle sizes for main branch" | |
| ./scripts/bundle-sizes.sh | |
| echo "✅ Baseline bundle sizes calculated" | |
| cat previous_sizes.json | |
| - name: Upload baseline bundle sizes | |
| uses: actions/upload-artifact@v5 | |
| with: | |
| name: bundle-size-baseline | |
| path: previous_sizes.json | |
| retention-days: 30 | |
| snapshot: | |
| if: ${{ github.event_name == 'workflow_dispatch' }} | |
| name: Publish Snapshots | |
| permissions: | |
| contents: write | |
| id-token: write | |
| issues: write | |
| pull-requests: write | |
| runs-on: ubuntu-latest | |
| env: | |
| HUSKY: 0 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| token: ${{ secrets.GH_TOKEN }} | |
| ref: ${{ inputs.branch }} | |
| - name: Setup Project | |
| uses: ./.github/actions/setup | |
| with: | |
| CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
| - name: Version Packages as prerelease | |
| run: pnpm changeset version --snapshot ${{ inputs.prerelease }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} | |
| # The actual npm publish that must occur in the authorized file | |
| - name: Publish packages with dist-tag | |
| run: pnpm publish -r --tag ${{ inputs.dist_tag }} --no-git-checks --access ${{ inputs.access }} |