Skip to content

Commit 3d13fa8

Browse files
committed
Auto-tag and release on version change
After all builds pass on master, extract the version from thinproxy.c and create a tag if one does not already exist. The tag push triggers the release workflow which creates the GitHub release and builds all assets.
1 parent 0ecf0b6 commit 3d13fa8

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

.github/workflows/build.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,34 @@ jobs:
7070
- name: Verify binary
7171
run: ./thinproxy -V
7272

73+
tag-release:
74+
name: Tag on version change
75+
runs-on: ubuntu-latest
76+
if: github.ref == 'refs/heads/master' && github.event_name == 'push'
77+
needs: [build-linux, build-macos]
78+
permissions:
79+
contents: write
80+
steps:
81+
- name: Checkout
82+
uses: actions/checkout@v6
83+
with:
84+
fetch-depth: 0
85+
86+
- name: Create tag if version changed
87+
run: |
88+
ver=$(sed -n 's/^#define THINPROXY_VERSION.*"\(.*\)"/\1/p' thinproxy.c)
89+
if [ -z "$ver" ]; then
90+
echo "Could not extract version"
91+
exit 1
92+
fi
93+
if git rev-parse "v${ver}" >/dev/null 2>&1; then
94+
echo "Tag v${ver} already exists, skipping"
95+
else
96+
echo "Creating tag v${ver}"
97+
git tag "v${ver}"
98+
git push origin "v${ver}"
99+
fi
100+
73101
build-macos:
74102
strategy:
75103
fail-fast: false

0 commit comments

Comments
 (0)