From 289edc03153a88b394e8689baf226d191b0e8c41 Mon Sep 17 00:00:00 2001 From: Marko Bevc Date: Tue, 28 Apr 2026 19:16:54 +0100 Subject: [PATCH 1/2] feat: auto release on tag --- .github/workflows/publish.yml | 38 +++++++++++++++++++++++++++-------- 1 file changed, 30 insertions(+), 8 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 0a95bb9..1af838c 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,8 +1,15 @@ -name: Publish +name: Release +# Triggered by pushing a semver tag (e.g. v2.1.3). +# 1. Creates a GitHub Release with auto-generated notes. +# 2. Builds dist/ and force-pushes action.yml + dist/ to the tag. +# 3. Updates the major version tag (v2.1.3 -> v2). on: - release: - types: [published, edited] + tags: + - 'v*.*.*' + +permissions: + contents: write jobs: notify-start: @@ -14,17 +21,32 @@ jobs: slack-channel-id: ${{ vars.SLACK_CHANNEL_ID }} stage: start - build: - name: Build + release: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + uses: actions/checkout@v6 + with: + fetch-depth: 0 + + - name: Setup Node.js + uses: actions/setup-node@v6 with: - ref: ${{ github.event.release.tag_name }} + node-version: 24 + cache: npm + - name: Install deps and build run: npm ci && npm run build - - uses: JasonEtco/build-and-tag-action@v2 + + - name: Create GitHub Release with auto-generated notes + uses: softprops/action-gh-release@v3 + with: + generate_release_notes: true + # Mark as prerelease if the tag contains a hyphen (e.g. v2.1.3-beta.1). + prerelease: ${{ contains(github.ref_name, '-') }} + + - name: Build and tag (force-pushes dist/ to the tag and updates major/minor refs) + uses: JasonEtco/build-and-tag-action@v2 env: GITHUB_TOKEN: ${{ github.token }} From 027d39d0e05ab980a5a990f49c1e451b7b4b5112 Mon Sep 17 00:00:00 2001 From: Marko Bevc Date: Tue, 28 Apr 2026 19:26:05 +0100 Subject: [PATCH 2/2] chore: clean up tests GHA --- .github/workflows/{publish.yml => release.yaml} | 0 .github/workflows/{test.yml => test.yaml} | 6 ++++-- 2 files changed, 4 insertions(+), 2 deletions(-) rename .github/workflows/{publish.yml => release.yaml} (100%) rename .github/workflows/{test.yml => test.yaml} (97%) diff --git a/.github/workflows/publish.yml b/.github/workflows/release.yaml similarity index 100% rename from .github/workflows/publish.yml rename to .github/workflows/release.yaml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yaml similarity index 97% rename from .github/workflows/test.yml rename to .github/workflows/test.yaml index 3d31874..3cd0de8 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yaml @@ -4,8 +4,8 @@ on: push: branches: - main - - patch-v1 - pull_request: + pull_request: {} + workflow_dispatch: {} defaults: run: @@ -39,6 +39,7 @@ jobs: kosli version --short >> $GITHUB_ENV echo "\n" >> $GITHUB_ENV echo 'EOF' >> $GITHUB_ENV + - name: Verify pinned version if: matrix.version != 'latest' shell: python @@ -49,6 +50,7 @@ jobs: sys.exit( int(not os.environ["KOSLI_VERSION_EXPECTED"] in os.environ["KOSLI_VERSION_INSTALLED"]) ) + - name: Verify latest resolved to a semver if: matrix.version == 'latest' shell: python