Skip to content

Commit 1cc739e

Browse files
authored
Merge pull request #21 from kosli-dev/20260428_auto_release
feat: auto release on tag
2 parents 2232bc1 + 027d39d commit 1cc739e

2 files changed

Lines changed: 34 additions & 10 deletions

File tree

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ on:
44
push:
55
branches:
66
- main
7-
- patch-v1
8-
pull_request:
7+
pull_request: {}
8+
workflow_dispatch: {}
99

1010
defaults:
1111
run:
@@ -39,6 +39,7 @@ jobs:
3939
kosli version --short >> $GITHUB_ENV
4040
echo "\n" >> $GITHUB_ENV
4141
echo 'EOF' >> $GITHUB_ENV
42+
4243
- name: Verify pinned version
4344
if: matrix.version != 'latest'
4445
shell: python
@@ -49,6 +50,7 @@ jobs:
4950
sys.exit(
5051
int(not os.environ["KOSLI_VERSION_EXPECTED"] in os.environ["KOSLI_VERSION_INSTALLED"])
5152
)
53+
5254
- name: Verify latest resolved to a semver
5355
if: matrix.version == 'latest'
5456
shell: python

0 commit comments

Comments
 (0)