11name : Go merge workflow
22
33on :
4- pull_request :
4+ pull_request :
55 types : [closed]
66 branches :
7- - main
7+ - main
88
99jobs :
10- merge_job :
11- name : Release Go Binary
10+ prepare_release :
11+ runs-on : ubuntu-latest
12+ outputs :
13+ release_created : ${{ steps.release_action_plan.outputs.releases_created }}
14+ steps :
15+ - name : Checkout code
16+ uses : actions/checkout@v4
17+
18+ - name : Release Please
19+ id : release_action_plan
20+ uses : google-github-actions/release-please-action@v4
21+ with :
22+ token : ${{ secrets.GITHUB_TOKEN }}
23+ release-type : go
24+ path : code/base-project/image-scan
25+
26+ build_and_release :
27+ needs : prepare_release
28+ if : needs.prepare_release.outputs.release_created == 'true'
1229 runs-on : ubuntu-latest
1330 strategy :
1431 matrix :
15- # build and publish in parallel: linux/386, linux/amd64, linux/arm64, windows/386, windows/amd64, darwin/amd64, darwin/arm64
1632 goos : [linux, windows, darwin]
1733 goarch : [amd64, arm64]
1834 exclude :
@@ -22,27 +38,13 @@ jobs:
2238 - name : Checkout code
2339 uses : actions/checkout@v4
2440
25- - uses : google-github-actions/release-please-action@v4
26- id : release_action_plan
27- with :
28- # this assumes that you have created a personal access token
29- # (PAT) and configured it as a GitHub action secret named
30- # `MY_RELEASE_PLEASE_TOKEN` (this secret name is not important).
31- token : ${{ secrets.GITHUB_TOKEN }}
32- # this is a built-in strategy in release-please, see "Action Inputs"
33- # for more options
34- release-type : go
35- path : code/base-project/image-scan
36-
37- - uses : wangyoucao577/go-release-action@v1
38- if : steps.release_action_plan.outputs.releases_created == 'true'
41+ - name : Build and Release Go Binary
42+ uses : wangyoucao577/go-release-action@v1
3943 with :
4044 github_token : ${{ secrets.GITHUB_TOKEN }}
4145 goos : ${{ matrix.goos }}
4246 goarch : ${{ matrix.goarch }}
4347 goversion : " https://go.dev/dl/go1.22.0.linux-amd64.tar.gz"
4448 project_path : " code/base-project/image-scan"
4549 binary_name : " image-scan"
46- release_tag : ${{ github.ref }}
47-
48-
50+ release_tag : ${{ github.event.release.tag_name }}
0 commit comments