From c03d887fd57e7ad5571e282956d5f0217f7961fa Mon Sep 17 00:00:00 2001 From: Jonathan Lam Date: Sun, 1 Mar 2026 14:02:28 -0800 Subject: [PATCH] Add semver label-based release workflow Replace tag-based releases with automatic releases on merge to main. Version is determined from PR labels (patch/minor/major) using the shared release-version action. PRs are blocked from merging without a semver label via the require-labels check. Co-Authored-By: Claude Opus 4.6 --- .github/workflows/ci-require-labels.yml | 13 +++++++++ .github/workflows/release.yml | 35 ++++++++++++++++++++----- 2 files changed, 41 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/ci-require-labels.yml diff --git a/.github/workflows/ci-require-labels.yml b/.github/workflows/ci-require-labels.yml new file mode 100644 index 0000000..47dfa9f --- /dev/null +++ b/.github/workflows/ci-require-labels.yml @@ -0,0 +1,13 @@ +name: CI Require Labels +on: + pull_request: + types: [opened, labeled, unlabeled, synchronize] +run-name: CI Require Labels by @${{ github.actor }} ${{ github.sha }} +permissions: + pull-requests: write +jobs: + require-labels: + runs-on: ubuntu-latest + steps: + - name: Require Labels + uses: nullify-platform/github-actions/actions/require-labels@main diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index fe7681b..d330f95 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,15 +1,34 @@ name: Release - on: push: - tags: - - 'v*' - + branches: + - main +concurrency: + group: release + cancel-in-progress: true +run-name: Release by @${{ github.actor }} ${{ github.sha }} permissions: contents: write - + pull-requests: read jobs: + get-version: + name: Version + runs-on: ubuntu-latest + outputs: + version: ${{ steps.get-version.outputs.version }} + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Get Release Version + id: get-version + uses: nullify-platform/github-actions/actions/release-version@main + - run: | + echo "**Version:** ${{ steps.get-version.outputs.version }}" >> $GITHUB_STEP_SUMMARY + build: + if: ${{ needs.get-version.outputs.version != 'undefined' }} + needs: [get-version] runs-on: ubuntu-latest strategy: matrix: @@ -42,9 +61,11 @@ jobs: path: slack-cli-${{ matrix.goos }}-${{ matrix.goarch }} release: - needs: build + needs: [get-version, build] runs-on: ubuntu-latest steps: + - uses: actions/checkout@v4 + - uses: actions/download-artifact@v4 with: path: artifacts @@ -53,4 +74,4 @@ jobs: - name: Create release env: GH_TOKEN: ${{ github.token }} - run: gh release create ${{ github.ref_name }} artifacts/* --repo ${{ github.repository }} --title "${{ github.ref_name }}" --generate-notes + run: gh release create "v${{ needs.get-version.outputs.version }}" artifacts/* --repo ${{ github.repository }} --title "v${{ needs.get-version.outputs.version }}" --generate-notes