Skip to content

Commit e312561

Browse files
authored
ci: migrate release workflow to uppt (#831)
1 parent bbb4253 commit e312561

1 file changed

Lines changed: 61 additions & 15 deletions

File tree

.github/workflows/release.yml

Lines changed: 61 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +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:
12-
release:
14+
pr:
15+
if: github.event_name == 'push' && github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
1316
runs-on: ubuntu-latest
17+
permissions:
18+
contents: write
19+
pull-requests: write
1420
steps:
15-
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
21+
- uses: danielroe/uppt/pr@4e0c42a0fd6091f59e5dfe168e69b57651e87bed # v0.5.4
1622
with:
17-
fetch-depth: 0
23+
token: ${{ secrets.GITHUB_TOKEN }}
1824

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
2140
with:
22-
node-version: 24
41+
token: ${{ secrets.GITHUB_TOKEN }}
2342

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

Comments
 (0)