|
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: |
| 14 | + pr: |
| 15 | + if: github.event_name == 'push' && github.ref == format('refs/heads/{0}', github.event.repository.default_branch) |
| 16 | + runs-on: ubuntu-latest |
| 17 | + permissions: |
| 18 | + contents: write |
| 19 | + pull-requests: write |
| 20 | + steps: |
| 21 | + - uses: danielroe/uppt/pr@4e0c42a0fd6091f59e5dfe168e69b57651e87bed # v0.5.4 |
| 22 | + with: |
| 23 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 24 | + |
12 | 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 |
13 | 32 | concurrency: |
14 | | - group: release |
| 33 | + group: release-${{ github.event.pull_request.number }} |
| 34 | + cancel-in-progress: false |
15 | 35 | permissions: |
16 | 36 | contents: write |
17 | | - id-token: write |
18 | | - runs-on: ubuntu-latest |
| 37 | + actions: write |
19 | 38 | steps: |
20 | | - - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 |
21 | | - with: |
22 | | - fetch-depth: 0 |
23 | | - - run: corepack enable |
24 | | - - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 |
| 39 | + - uses: danielroe/uppt/release@4e0c42a0fd6091f59e5dfe168e69b57651e87bed # v0.5.4 |
25 | 40 | with: |
26 | | - node-version: latest |
| 41 | + token: ${{ secrets.GITHUB_TOKEN }} |
27 | 42 |
|
28 | | - - name: 📦 Install dependencies |
29 | | - run: pnpm install |
30 | | - |
31 | | - - name: 🛠 Build project |
32 | | - run: pnpm build |
33 | | - |
34 | | - - name: 📦 Release |
35 | | - run: pnpm publish --no-git-checks |
| 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 |
36 | 55 |
|
37 | | - - name: 📦 Release |
38 | | - run: pnpm changelogithub |
39 | | - env: |
40 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 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