Skip to content

Commit 88937c2

Browse files
authored
Update release.yaml
1 parent cbac00a commit 88937c2

File tree

1 file changed

+33
-18
lines changed

1 file changed

+33
-18
lines changed

.github/workflows/release.yaml

Lines changed: 33 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,22 @@
11
name: Release Auparse
22
on:
33
push:
4-
branches:
5-
- 'feature/release'
4+
tags:
5+
- 'v*'
66
workflow_dispatch:
77
inputs:
88
version:
99
description: 'Version'
1010
required: true
1111
type: string
12-
default: '2.5.0'
12+
default: '2.6.1'
13+
1314
permissions:
14-
contents: read
15+
contents: write
16+
1517
jobs:
1618
build:
17-
name: Release
19+
name: Build Binaries
1820
runs-on: ubuntu-latest
1921
strategy:
2022
matrix:
@@ -26,33 +28,46 @@ jobs:
2628
- name: Checkout code
2729
uses: actions/checkout@v4
2830
with:
29-
tag: 'refs/tags/v${{ inputs.version }}'
31+
ref: 'refs/tags/v${{ inputs.version }}' # Fixed tag reference
32+
3033
- name: Set up Go
3134
uses: actions/setup-go@v5
3235
with:
3336
go-version: 1.21.6
37+
3438
- name: Build
3539
run: |
3640
GOOS="${{ matrix.os }}" GOARCH="${{ matrix.arch }}" go build -o bin/auparse-${{ env.tag }} cmd/auparse/auparse.go
41+
3742
- name: Upload Artifact
3843
uses: actions/upload-artifact@v4
3944
with:
4045
name: auparse-${{ env.tag }}
4146
path: bin/auparse-${{ env.tag }}
47+
4248
release:
4349
name: Release
4450
runs-on: ubuntu-latest
4551
needs: build
4652
steps:
47-
- name: Download Artifact
48-
uses: actions/download-artifact@v4
49-
with:
50-
path: bin
51-
- name: Release
52-
uses: softprops/action-gh-release@v2
53-
with:
54-
files: bin/auparse-*
55-
name: '${{ inputs.version }}'
56-
tag_name: '${{ inputs.version }}'
57-
generate_release_notes: true
58-
token: '${{ secrets.GITHUB_TOKEN }}'
53+
- name: Download Artifact
54+
uses: actions/download-artifact@v4
55+
with:
56+
path: bin
57+
58+
- name: Create Tag (if missing)
59+
run: |
60+
if ! git rev-parse "v${{ inputs.version }}" >/dev/null 2>&1; then
61+
git tag v${{ inputs.version }}
62+
git push origin v${{ inputs.version }}
63+
fi
64+
65+
- name: Release
66+
uses: softprops/action-gh-release@v2
67+
with:
68+
files: bin/auparse-*
69+
name: 'Release ${{ inputs.version }}'
70+
tag_name: 'v${{ inputs.version }}'
71+
generate_release_notes: true
72+
env:
73+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)