From e96c006aad42bdd646dfec660b5aa7c75e06350e Mon Sep 17 00:00:00 2001 From: buty4649 Date: Wed, 18 Jun 2025 13:49:40 +0900 Subject: [PATCH] Use tagpr --- .github/actions/release/action.yml | 25 +++++++++++++++++++++++++ .github/workflows/release.yml | 15 ++------------- .github/workflows/tagpr.yml | 25 +++++++++++++++++++++++++ 3 files changed, 52 insertions(+), 13 deletions(-) create mode 100644 .github/actions/release/action.yml create mode 100644 .github/workflows/tagpr.yml diff --git a/.github/actions/release/action.yml b/.github/actions/release/action.yml new file mode 100644 index 0000000..b240ad3 --- /dev/null +++ b/.github/actions/release/action.yml @@ -0,0 +1,25 @@ +name: 'Release Action' +description: 'Reusable workflow for releasing with GoReleaser' + +inputs: + github_token: + description: 'GitHub token for authentication' + required: true + +runs: + using: "composite" + steps: + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version-file: 'go.mod' + cache: true + + - name: Run GoReleaser + uses: goreleaser/goreleaser-action@v6 + with: + distribution: goreleaser + version: latest + args: release --clean + env: + GITHUB_TOKEN: ${{ inputs.github_token }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 734d2f6..a2516f7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,17 +14,6 @@ jobs: with: fetch-depth: 0 - - name: Set up Go - uses: actions/setup-go@v5 + - uses: ./.github/actions/release with: - go-version: '1.24' - cache: true - - - name: Run GoReleaser - uses: goreleaser/goreleaser-action@v6 - with: - distribution: goreleaser - version: latest - args: release --clean - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + github_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/tagpr.yml b/.github/workflows/tagpr.yml new file mode 100644 index 0000000..df2eca6 --- /dev/null +++ b/.github/workflows/tagpr.yml @@ -0,0 +1,25 @@ +name: tagpr + +on: + push: + branches: + - main + +jobs: + tagpr: + name: tagpr + runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write + issues: write + steps: + - uses: actions/checkout@v4 + - uses: Songmu/tagpr@v1 + id: tagpr + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - uses: ./.github/actions/release + if: steps.tagpr.outputs.tag != '' + with: + github_token: ${{ secrets.GITHUB_TOKEN }}