|
| 1 | +name: Release |
| 2 | + |
| 3 | +# Public repo workflow using token-based checkout to access private npm-release-workflows |
| 4 | + |
| 5 | +on: |
| 6 | + workflow_dispatch: |
| 7 | + inputs: |
| 8 | + dry_run: |
| 9 | + description: 'Test release without publishing (creates PR but skips npm publish)' |
| 10 | + type: boolean |
| 11 | + default: false |
| 12 | + required: false |
| 13 | + |
| 14 | +jobs: |
| 15 | + validate: |
| 16 | + runs-on: pub-hk-ubuntu-24.04-ip # Options: ubuntu-latest | sfdc-hk-ubuntu-latest | pub-hk-ubuntu-24.04-ip |
| 17 | + steps: |
| 18 | + - uses: actions/checkout@v4 |
| 19 | + |
| 20 | + - name: Checkout workflows repository |
| 21 | + uses: actions/checkout@v4 |
| 22 | + with: |
| 23 | + repository: heroku/npm-release-workflows |
| 24 | + token: ${{ secrets.WORKFLOWS_ACCESS_GITHUB_TOKEN }} |
| 25 | + path: workflows-repo |
| 26 | + ref: main |
| 27 | + |
| 28 | + - name: Validate and test |
| 29 | + uses: ./workflows-repo/.github/actions/release-validate-public |
| 30 | + with: |
| 31 | + package-manager: yarn # npm | yarn | pnpm |
| 32 | + lint_command: 'run lint' |
| 33 | + test_command: 'run test' |
| 34 | + |
| 35 | + release-please-pr: |
| 36 | + needs: validate |
| 37 | + runs-on: pub-hk-ubuntu-24.04-ip # Options: ubuntu-latest | sfdc-hk-ubuntu-latest | pub-hk-ubuntu-24.04-ip |
| 38 | + permissions: |
| 39 | + contents: write |
| 40 | + pull-requests: write |
| 41 | + outputs: |
| 42 | + release_created: ${{ steps.release-workflow.outputs.release_created }} |
| 43 | + tag_name: ${{ steps.release-workflow.outputs.tag_name }} |
| 44 | + pr_number: ${{ steps.release-workflow.outputs.pr_number }} |
| 45 | + config_file: ${{ steps.release-workflow.outputs.config_file }} |
| 46 | + manifest_file: ${{ steps.release-workflow.outputs.manifest_file }} |
| 47 | + npm_tag: ${{ steps.release-workflow.outputs.npm_tag }} |
| 48 | + package_name: ${{ steps.release-workflow.outputs.package_name }} |
| 49 | + no_release_needed: ${{ steps.release-workflow.outputs.no_release_needed }} |
| 50 | + pr_already_exists: ${{ steps.release-workflow.outputs.pr_already_exists }} |
| 51 | + steps: |
| 52 | + - uses: actions/checkout@v4 |
| 53 | + |
| 54 | + - name: Checkout workflows repository |
| 55 | + uses: actions/checkout@v4 |
| 56 | + with: |
| 57 | + repository: heroku/npm-release-workflows |
| 58 | + token: ${{ secrets.WORKFLOWS_ACCESS_GITHUB_TOKEN }} |
| 59 | + path: workflows-repo |
| 60 | + ref: main |
| 61 | + |
| 62 | + - name: Create release PR |
| 63 | + id: release-workflow |
| 64 | + uses: ./workflows-repo/.github/actions/release-please-pr-public |
| 65 | + with: |
| 66 | + package-manager: yarn # npm | yarn | pnpm |
| 67 | + branch_name: ${{ github.ref_name }} |
| 68 | + dry_run: ${{ inputs.dry_run }} |
| 69 | + |
| 70 | + publish: |
| 71 | + needs: release-please-pr |
| 72 | + if: needs.release-please-pr.result == 'success' && (needs.release-please-pr.outputs.pr_number != '' || needs.release-please-pr.outputs.pr_already_exists == 'true') |
| 73 | + runs-on: pub-hk-ubuntu-24.04-ip # Options: ubuntu-latest | sfdc-hk-ubuntu-latest | pub-hk-ubuntu-24.04-ip |
| 74 | + permissions: |
| 75 | + contents: write |
| 76 | + pull-requests: write |
| 77 | + id-token: write |
| 78 | + steps: |
| 79 | + - uses: actions/checkout@v4 |
| 80 | + |
| 81 | + - name: Checkout workflows repository |
| 82 | + uses: actions/checkout@v4 |
| 83 | + with: |
| 84 | + repository: heroku/npm-release-workflows |
| 85 | + token: ${{ secrets.WORKFLOWS_ACCESS_GITHUB_TOKEN }} |
| 86 | + path: workflows-repo |
| 87 | + ref: main |
| 88 | + |
| 89 | + - name: Publish to npm |
| 90 | + uses: ./workflows-repo/.github/actions/release-publish-public |
| 91 | + with: |
| 92 | + package-manager: yarn # npm | yarn | pnpm |
| 93 | + workflows_token: ${{ secrets.WORKFLOWS_ACCESS_GITHUB_TOKEN }} |
| 94 | + build_command: 'run build' |
| 95 | + dry_run: ${{ inputs.dry_run }} |
| 96 | + npm_tag: ${{ needs.release-please-pr.outputs.npm_tag }} |
| 97 | + package_name: ${{ needs.release-please-pr.outputs.package_name }} |
| 98 | + pr_number: ${{ needs.release-please-pr.outputs.pr_number }} |
| 99 | + branch_name: ${{ github.ref_name }} |
0 commit comments