11name : Release Auparse
22on :
33 push :
4- branches :
5- - ' feature/release'
6- workflow_dispatch :
7- inputs :
8- version :
9- description : ' Version'
10- required : true
11- type : string
12- default : ' 2.6.1'
4+ tags :
5+ - ' v*' # Runs only when a new tag is pushed (e.g., v2.6.1, v3.0.0)
136
147permissions :
158 contents : write
@@ -23,19 +16,12 @@ jobs:
2316 os : [ linux, darwin ]
2417 arch : [ amd64, arm64 ]
2518 env :
26- tag : v ${{ inputs.version }}-${{ matrix.os }}-${{ matrix.arch }}
19+ tag : ${{ github.ref_name }}-${{ matrix.os }}-${{ matrix.arch }}
2720 steps :
2821 - name : Checkout code
2922 uses : actions/checkout@v4
3023 with :
31- fetch-depth : 0 # Ensure all tags and history are fetched
32-
33- - name : Create and Push Tag if Missing
34- run : |
35- if ! git rev-parse "v${{ inputs.version }}" >/dev/null 2>&1; then
36- git tag v${{ inputs.version }}
37- git push origin v${{ inputs.version }}
38- fi
24+ fetch-depth : 0 # Fetch all tags
3925
4026 - name : Set up Go
4127 uses : actions/setup-go@v5
6147 uses : actions/checkout@v4
6248 with :
6349 fetch-depth : 0 # Ensure all tags are fetched
64- ref : v ${{ inputs.version }}
50+ ref : ${{ github.ref_name }}
6551
6652 - name : Download Artifact
6753 uses : actions/download-artifact@v4
7258 uses : softprops/action-gh-release@v2
7359 with :
7460 files : bin/auparse-*
75- name : ' Release v ${{ inputs.version }}'
76- tag_name : ' v ${{ inputs.version }}'
61+ name : ' Release ${{ github.ref_name }}'
62+ tag_name : ' ${{ github.ref_name }}'
7763 generate_release_notes : true
7864 env :
7965 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments