|
1 | | -name: Release |
2 | | - |
3 | | -permissions: |
4 | | - contents: write |
| 1 | +name: release |
5 | 2 |
|
6 | 3 | on: |
7 | 4 | push: |
8 | | - tags: |
9 | | - - 'v*' |
| 5 | + branches: [main] |
| 6 | + pull_request: |
| 7 | + types: [closed] |
| 8 | + branches: [main] |
| 9 | + workflow_dispatch: |
| 10 | + |
| 11 | +permissions: {} |
10 | 12 |
|
11 | 13 | jobs: |
12 | | - release: |
| 14 | + pr: |
| 15 | + if: github.event_name == 'push' && github.ref == format('refs/heads/{0}', github.event.repository.default_branch) |
13 | 16 | runs-on: ubuntu-latest |
| 17 | + permissions: |
| 18 | + contents: write |
| 19 | + pull-requests: write |
14 | 20 | steps: |
15 | | - - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 |
| 21 | + - uses: danielroe/uppt/pr@4e0c42a0fd6091f59e5dfe168e69b57651e87bed # v0.5.4 |
16 | 22 | with: |
17 | | - fetch-depth: 0 |
| 23 | + token: ${{ secrets.GITHUB_TOKEN }} |
18 | 24 |
|
19 | | - - name: Set node |
20 | | - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6 |
| 25 | + release: |
| 26 | + if: | |
| 27 | + github.event_name == 'pull_request' |
| 28 | + && github.event.pull_request.merged == true |
| 29 | + && startsWith(github.event.pull_request.head.ref, 'release/v') |
| 30 | + && github.event.pull_request.head.repo.full_name == github.repository |
| 31 | + runs-on: ubuntu-latest |
| 32 | + concurrency: |
| 33 | + group: release-${{ github.event.pull_request.number }} |
| 34 | + cancel-in-progress: false |
| 35 | + permissions: |
| 36 | + contents: write |
| 37 | + actions: write |
| 38 | + steps: |
| 39 | + - uses: danielroe/uppt/release@4e0c42a0fd6091f59e5dfe168e69b57651e87bed # v0.5.4 |
21 | 40 | with: |
22 | | - node-version: 24 |
| 41 | + token: ${{ secrets.GITHUB_TOKEN }} |
23 | 42 |
|
24 | | - - run: npx changelogithub |
25 | | - env: |
26 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 43 | + pack: |
| 44 | + if: github.event_name == 'workflow_dispatch' && startsWith(github.ref, 'refs/tags/v') |
| 45 | + runs-on: ubuntu-latest |
| 46 | + concurrency: |
| 47 | + group: pack-${{ github.ref }} |
| 48 | + cancel-in-progress: false |
| 49 | + permissions: {} |
| 50 | + outputs: |
| 51 | + files: ${{ steps.pack.outputs.files }} |
| 52 | + steps: |
| 53 | + - id: pack |
| 54 | + uses: danielroe/uppt/pack@4e0c42a0fd6091f59e5dfe168e69b57651e87bed # v0.5.4 |
| 55 | + |
| 56 | + publish: |
| 57 | + if: | |
| 58 | + github.event_name == 'workflow_dispatch' |
| 59 | + && startsWith(github.ref, 'refs/tags/v') |
| 60 | + && needs.pack.outputs.files != '[]' |
| 61 | + needs: pack |
| 62 | + runs-on: ubuntu-latest |
| 63 | + concurrency: |
| 64 | + group: publish-${{ github.ref }} |
| 65 | + cancel-in-progress: false |
| 66 | + permissions: |
| 67 | + id-token: write |
| 68 | + environment: npm |
| 69 | + steps: |
| 70 | + - uses: danielroe/uppt/publish@4e0c42a0fd6091f59e5dfe168e69b57651e87bed # v0.5.4 |
| 71 | + with: |
| 72 | + files: ${{ needs.pack.outputs.files }} |
0 commit comments