Skip to content

Commit 75cdf81

Browse files
committed
feat(ci): tag every main commit
1 parent b36b3ba commit 75cdf81

1 file changed

Lines changed: 18 additions & 6 deletions

File tree

.github/workflows/create-release-tag.yml

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
name: Create Release Tags
22

3-
# This workflow automatically creates and pushes release tags when manually triggered
4-
# It's designed to make the action ready for use in other repositories
3+
# This workflow creates and pushes release tags for every commit to main,
4+
# and also supports manual tagging via workflow_dispatch.
55

66
on:
7+
push:
8+
branches:
9+
- main
710
workflow_dispatch:
811
inputs:
912
version:
10-
description: 'Version number (e.g., 1.0.0)'
11-
required: true
13+
description: 'Version number (e.g., 1.0.0). Leave empty to auto-generate.'
14+
required: false
1215
type: string
1316
create_release:
1417
description: 'Create GitHub Release'
@@ -31,7 +34,12 @@ jobs:
3134

3235
- name: Validate version format
3336
run: |
34-
VERSION="${{ github.event.inputs.version }}"
37+
INPUT_VERSION="${{ github.event.inputs.version }}"
38+
if [ -n "${INPUT_VERSION:-}" ]; then
39+
VERSION="$INPUT_VERSION"
40+
else
41+
VERSION="1.0.${{ github.run_number }}"
42+
fi
3543
if ! [[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
3644
echo "Error: Version must be in semver format (e.g., 1.0.0)"
3745
exit 1
@@ -53,6 +61,10 @@ jobs:
5361
- name: Create semantic version tag
5462
run: |
5563
echo "Creating tag ${FULL_VERSION}..."
64+
if git rev-parse "$FULL_VERSION" >/dev/null 2>&1; then
65+
echo "Tag ${FULL_VERSION} already exists; skipping."
66+
exit 0
67+
fi
5668
git tag -a "$FULL_VERSION" -m "${FULL_VERSION} - Release of ProverCoderAI Release Action"
5769
git push origin "$FULL_VERSION"
5870
@@ -76,7 +88,7 @@ jobs:
7688
echo " - uses: ProverCoderAI/action-release@${FULL_VERSION}"
7789
7890
- name: Create GitHub Release
79-
if: github.event.inputs.create_release == 'true'
91+
if: github.event_name == 'workflow_dispatch' && github.event.inputs.create_release == 'true'
8092
uses: softprops/action-gh-release@v2
8193
with:
8294
tag_name: ${{ env.FULL_VERSION }}

0 commit comments

Comments
 (0)