@@ -31,15 +31,58 @@ jobs:
31
31
- goarch : arm64
32
32
goos : windows
33
33
steps :
34
+ - id : read_tag
35
+ name : Read release tag name (mostly vx.x.x)
36
+ run : |
37
+ if [ "${{ github.event_name }}" = "release" ]; then
38
+ export TAG="${{ github.ref_name }}"
39
+ elif [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
40
+ export TAG="${{ inputs.release }}"
41
+ fi
42
+
43
+ echo "release_tag=${TAG}" >> "$GITHUB_OUTPUT"
44
+
34
45
- uses : actions/checkout@v3
46
+ with :
47
+ ref : ${{ steps.read_tag.outputs.release_tag }}
48
+
49
+ - name : Read Go version from go.mod
50
+ id : read_go_version
51
+ run : |
52
+ go_version_raw=$(grep "^go " go.mod | awk '{print $2}')
53
+ echo "go_version=${go_version_raw}" >> "$GITHUB_OUTPUT"
54
+
55
+ # Find the path for main.go file as recently golang project
56
+ # structure was finally standardized
57
+ - name : Determine main.go path
58
+ id : find_main_go
59
+ run : |
60
+ if [ -f "./main.go" ]; then
61
+ echo "main_go_path=./" >> "$GITHUB_OUTPUT"
62
+ else
63
+ echo "main_go_path=./cmd/" >> "$GITHUB_OUTPUT"
64
+ fi
65
+
66
+ # Omit the LICENSE file only for the very first release.
67
+ # This step is only to manage some technical debt we caused in the beginning.
68
+ - name : Find release extra files
69
+ id : find_release_extra_files
70
+ run : |
71
+ if [ -f "./LICENSE" ]; then
72
+ echo "release_extra_files=LICENSE README.md" >> "$GITHUB_OUTPUT"
73
+ else
74
+ echo "release_extra_files=README.md" >> "$GITHUB_OUTPUT"
75
+ fi
76
+
35
77
- uses : wangyoucao577/go-release-action@v1.31
36
78
with :
37
79
github_token : ${{ secrets.GITHUB_TOKEN }}
38
80
goos : ${{ matrix.goos }}
39
81
goarch : ${{ matrix.goarch }}
40
- goversion : " https://dl.google.com/go/go1.19.13.linux-amd64.tar.gz"
41
- project_path : " ./"
82
+ # goversion: "${{ steps.read_go_version.outputs.go_version }}"
83
+ goversion : " https://dl.google.com/go/go${{ steps.read_go_version.outputs.go_version }}.linux-amd64.tar.gz"
84
+ project_path : " ${{ steps.find_main_go.outputs.main_go_path }}"
42
85
binary_name : " rabbit-stalker"
43
86
release_tag : ${{ inputs.release }}
44
87
overwrite : true
45
- extra_files : LICENSE README.md
88
+ extra_files : " ${{ steps.find_release_extra_files.outputs.release_extra_files }} "
0 commit comments