Skip to content

Commit

Permalink
ci: use tagpr
Browse files Browse the repository at this point in the history
  • Loading branch information
go-to-k committed Aug 16, 2024
1 parent 4fbc884 commit 82fe0d2
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 12 deletions.
21 changes: 21 additions & 0 deletions .github/actions/release/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: release
inputs:
github-token:
required: true
homebrew-tap-github-token:
required: true
runs:
using: composite
steps:
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ inputs.github-token }}
HOMEBREW_TAP_GITHUB_TOKEN: ${{ inputs.homebrew-tap-github-token }}
4 changes: 3 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ on:
- "v[0-9]+.[0-9]+.[0-9]+"
branches:
- "*"
branches-ignore:
- "tagpr.*"
pull_request:
types:
- opened
Expand All @@ -25,7 +27,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: 1.21
go-version-file: go.mod
id: go
- name: Cache
uses: actions/cache@v4
Expand Down
15 changes: 4 additions & 11 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# for manual release (No triggering when tagpr is used.)
name: release
on:
push:
Expand All @@ -11,15 +12,7 @@ jobs:
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@v5
- uses: ./.github/actions/release
with:
go-version: 1.21
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
HOMEBREW_TAP_GITHUB_TOKEN: ${{ secrets.HOMEBREW_TAP_GITHUB_TOKEN }}
github-token: ${{ secrets.GITHUB_TOKEN }}
homebrew-tap-github-token: ${{ secrets.HOMEBREW_TAP_GITHUB_TOKEN }}
23 changes: 23 additions & 0 deletions .github/workflows/tagpr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: tagpr
on:
push:
branches:
- "main"
jobs:
tagpr:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: tagpr
id: tagpr
uses: Songmu/tagpr@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: ./.github/actions/release
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
homebrew-tap-github-token: ${{ secrets.HOMEBREW_TAP_GITHUB_TOKEN }}
if: "steps.tagpr.outputs.tag != ''"

0 comments on commit 82fe0d2

Please sign in to comment.