From 1077705426600687fb5fd9c2ba3caea638584ddd Mon Sep 17 00:00:00 2001 From: Alexander Satretdinov Date: Mon, 16 Nov 2026 22:26:47 +0200 Subject: [PATCH] ci: release-please opens a release PR from conventional commits; merging it tags, publishes and uploads dist; PR titles are checked --- .github/workflows/pr-title.yml | 16 ++++++++++++++++ .github/workflows/release.yml | 28 ++++++++++++++++++++++------ .release-please-manifest.json | 3 +++ release-please-config.json | 10 ++++++++++ 4 files changed, 51 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/pr-title.yml create mode 100644 .release-please-manifest.json create mode 100644 release-please-config.json diff --git a/.github/workflows/pr-title.yml b/.github/workflows/pr-title.yml new file mode 100644 index 0000000..3b0d86b --- /dev/null +++ b/.github/workflows/pr-title.yml @@ -0,0 +1,16 @@ +name: PR title + +on: + pull_request: + types: [opened, edited, synchronize, reopened] + +permissions: + pull-requests: read + +jobs: + conventional: + runs-on: ubuntu-latest + steps: + - uses: amannn/action-semantic-pull-request@v5 + env: + GITHUB_TOKEN: ${{ github.token }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 49a3f9a..48cd6fe 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,29 +2,45 @@ name: Release on: push: - tags: ["v*"] + branches: [master] permissions: contents: write + pull-requests: write jobs: + release-please: + runs-on: ubuntu-latest + outputs: + created: ${{ steps.rp.outputs.release_created }} + tag: ${{ steps.rp.outputs.tag_name }} + steps: + - id: rp + uses: googleapis/release-please-action@v4 + ci: + needs: release-please + if: needs.release-please.outputs.created == 'true' uses: ./.github/workflows/ci.yml - release: - needs: ci + dist: + needs: [release-please, ci] runs-on: ubuntu-latest + env: + TAG: ${{ needs.release-please.outputs.tag }} steps: - uses: actions/checkout@v7 + with: + ref: ${{ env.TAG }} - uses: actions/setup-go@v7 with: go-version-file: go.mod - name: Build - run: make dist VERSION="${GITHUB_REF_NAME#v}" + run: make dist VERSION="${TAG#v}" - - name: Publish + - name: Upload env: GH_TOKEN: ${{ github.token }} - run: gh release create "$GITHUB_REF_NAME" dist/* --title "$GITHUB_REF_NAME" --generate-notes + run: gh release upload "$TAG" dist/* diff --git a/.release-please-manifest.json b/.release-please-manifest.json new file mode 100644 index 0000000..0ee8c01 --- /dev/null +++ b/.release-please-manifest.json @@ -0,0 +1,3 @@ +{ + ".": "0.3.0" +} diff --git a/release-please-config.json b/release-please-config.json new file mode 100644 index 0000000..d3c0322 --- /dev/null +++ b/release-please-config.json @@ -0,0 +1,10 @@ +{ + "$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json", + "packages": { + ".": { + "release-type": "go", + "bump-minor-pre-major": true, + "bump-patch-for-minor-pre-major": false + } + } +}