Skip to content

Commit 289edc0

Browse files
committed
feat: auto release on tag
1 parent 2232bc1 commit 289edc0

1 file changed

Lines changed: 30 additions & 8 deletions

File tree

.github/workflows/publish.yml

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
1-
name: Publish
1+
name: Release
22

3+
# Triggered by pushing a semver tag (e.g. v2.1.3).
4+
# 1. Creates a GitHub Release with auto-generated notes.
5+
# 2. Builds dist/ and force-pushes action.yml + dist/ to the tag.
6+
# 3. Updates the major version tag (v2.1.3 -> v2).
37
on:
4-
release:
5-
types: [published, edited]
8+
tags:
9+
- 'v*.*.*'
10+
11+
permissions:
12+
contents: write
613

714
jobs:
815
notify-start:
@@ -14,17 +21,32 @@ jobs:
1421
slack-channel-id: ${{ vars.SLACK_CHANNEL_ID }}
1522
stage: start
1623

17-
build:
18-
name: Build
24+
release:
1925
runs-on: ubuntu-latest
2026
steps:
2127
- name: Checkout
22-
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
28+
uses: actions/checkout@v6
29+
with:
30+
fetch-depth: 0
31+
32+
- name: Setup Node.js
33+
uses: actions/setup-node@v6
2334
with:
24-
ref: ${{ github.event.release.tag_name }}
35+
node-version: 24
36+
cache: npm
37+
2538
- name: Install deps and build
2639
run: npm ci && npm run build
27-
- uses: JasonEtco/build-and-tag-action@v2
40+
41+
- name: Create GitHub Release with auto-generated notes
42+
uses: softprops/action-gh-release@v3
43+
with:
44+
generate_release_notes: true
45+
# Mark as prerelease if the tag contains a hyphen (e.g. v2.1.3-beta.1).
46+
prerelease: ${{ contains(github.ref_name, '-') }}
47+
48+
- name: Build and tag (force-pushes dist/ to the tag and updates major/minor refs)
49+
uses: JasonEtco/build-and-tag-action@v2
2850
env:
2951
GITHUB_TOKEN: ${{ github.token }}
3052

0 commit comments

Comments
 (0)