Skip to content

Commit d4dc90d

Browse files
committed
ci: migrate release workflow to uppt
1 parent 697ccf5 commit d4dc90d

1 file changed

Lines changed: 59 additions & 27 deletions

File tree

.github/workflows/release.yml

Lines changed: 59 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,72 @@
1-
name: Release
2-
3-
permissions:
4-
contents: write
1+
name: release
52

63
on:
74
push:
8-
tags:
9-
- 'v*'
5+
branches: [main]
6+
pull_request:
7+
types: [closed]
8+
branches: [main]
9+
workflow_dispatch:
10+
11+
permissions: {}
1012

1113
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+
1225
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
1332
concurrency:
14-
group: release
33+
group: release-${{ github.event.pull_request.number }}
34+
cancel-in-progress: false
1535
permissions:
1636
contents: write
17-
id-token: write
18-
runs-on: ubuntu-latest
37+
actions: write
1938
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
2540
with:
26-
node-version: latest
41+
token: ${{ secrets.GITHUB_TOKEN }}
2742

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
3655

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

Comments
 (0)