Skip to content

Commit 7ecd6aa

Browse files
committed
chore: migrate to changelog -> release workflow
1 parent be0b2b3 commit 7ecd6aa

File tree

6 files changed

+320
-362
lines changed

6 files changed

+320
-362
lines changed

.github/workflows/changelog.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
permissions:
9+
pull-requests: write
10+
contents: write
11+
12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.event.number || github.sha }}
14+
cancel-in-progress: ${{ github.event_name != 'push' }}
15+
16+
jobs:
17+
update-changelog:
18+
if: github.repository_owner == 'nuxt-contrib' && !contains(github.event.head_commit.message, 'v2.')
19+
runs-on: ubuntu-latest
20+
21+
steps:
22+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
23+
with:
24+
fetch-depth: 0
25+
- uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0
26+
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
27+
with:
28+
node-version: latest
29+
cache: "pnpm"
30+
31+
- name: 📦 Install dependencies
32+
run: pnpm install
33+
34+
- run: node ./scripts/update-changelog.ts
35+
env:
36+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/release.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: release
2+
3+
on:
4+
pull_request_target:
5+
types: [closed]
6+
branches:
7+
- main
8+
9+
# Remove default permissions of GITHUB_TOKEN for security
10+
# https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs
11+
permissions: {}
12+
13+
jobs:
14+
release:
15+
if: github.repository_owner == 'nuxt-contrib' && github.event.pull_request.merged == true && startsWith(github.event.pull_request.head.ref, 'v')
16+
concurrency:
17+
group: release
18+
permissions:
19+
contents: write
20+
id-token: write
21+
runs-on: ubuntu-latest
22+
timeout-minutes: 20
23+
steps:
24+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
25+
with:
26+
fetch-depth: 0
27+
- uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0
28+
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
29+
with:
30+
node-version: latest
31+
cache: "pnpm"
32+
33+
- name: 📦 Install dependencies
34+
run: pnpm install
35+
36+
- name: 🛠 Build and release project
37+
run: npm publish
38+
39+
- name: 🏷️ Create tag
40+
env:
41+
TAG_NAME: ${{ github.event.pull_request.head.ref }}
42+
run: |
43+
git tag "$TAG_NAME"
44+
git push origin "$TAG_NAME"
45+
46+
- name: 🛳️ Create GitHub release
47+
env:
48+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
49+
TAG_NAME: ${{ github.event.pull_request.head.ref }}
50+
RELEASE_NAME: ${{ github.event.pull_request.head.ref }}
51+
BODY: ${{ github.event.pull_request.body }}
52+
run: gh release create "$TAG_NAME" --title "$RELEASE_NAME" --notes "$BODY"

0 commit comments

Comments
 (0)