Updated tagging
This commit is contained in:
@@ -36,23 +36,50 @@ jobs:
|
||||
python3 SpearheadCompile.py . ./output/spearhead.lua
|
||||
|
||||
- name: Calculate Tag
|
||||
id: tag_version_dry
|
||||
uses: mathieudutour/github-tag-action@v6.2
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
default_bump: ${{ inputs.change_size }}
|
||||
custom_release_rules: ""
|
||||
dry_run: true
|
||||
append_to_pre_release_tag: "rc"
|
||||
id: calculate_tag
|
||||
run: |
|
||||
# Get latest tag with 'v' prefix
|
||||
latest_tag=$(git tag --sort=-v:refname | grep -E '^v' | head -n 1)
|
||||
if [ -z "$latest_tag" ]; then
|
||||
latest_tag="v0.0.0"
|
||||
fi
|
||||
echo "Latest tag: $latest_tag"
|
||||
# Remove 'v' prefix for version parsing
|
||||
version=${latest_tag#v}
|
||||
IFS='.' read -r major minor patch <<< "$version"
|
||||
bump="${{ inputs.change_size }}"
|
||||
if [ "$bump" = "major" ]; then
|
||||
major=$((major+1))
|
||||
minor=0
|
||||
patch=0
|
||||
elif [ "$bump" = "minor" ]; then
|
||||
minor=$((minor+1))
|
||||
patch=0
|
||||
else
|
||||
patch=$((patch+1))
|
||||
fi
|
||||
new_tag="v${major}.${minor}.${patch}"
|
||||
if [ "${{ inputs.release_candidate }}" = "true" ]; then
|
||||
new_tag="$new_tag-rc"
|
||||
fi
|
||||
echo "New tag: $new_tag"
|
||||
echo "new_tag=$new_tag" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Check for existing tag
|
||||
id: check_tag
|
||||
run: |
|
||||
if git tag | grep -q "${{ steps.tag_version_dry.outputs.new_tag }}"; then
|
||||
if git tag | grep -q "^${{ steps.calculate_tag.outputs.new_tag }}$"; then
|
||||
echo "Tag already exists. Exiting."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Apply Tag to Current Commit
|
||||
run: |
|
||||
git config user.name "github-actions"
|
||||
git config user.email "github-actions@github.com"
|
||||
git tag ${{ steps.calculate_tag.outputs.new_tag }}
|
||||
git push origin ${{ steps.calculate_tag.outputs.new_tag }}
|
||||
|
||||
- name: Generate Release Notes
|
||||
id: generate_release_notes
|
||||
run: |
|
||||
@@ -65,31 +92,12 @@ jobs:
|
||||
cat release_notes.txt
|
||||
shell: bash
|
||||
|
||||
- name: Check Change size PC
|
||||
id: retag
|
||||
run: |
|
||||
tag="${{ steps.tag_version_dry.outputs.new_tag }}"
|
||||
if [ "${{ inputs.release_candidate }}" = "true" ]; then
|
||||
echo "tag=$tag-rc" >> "$GITHUB_OUTPUT"
|
||||
else
|
||||
echo "tag=$tag" >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
|
||||
- name: Calculate Tag
|
||||
id: tag_version
|
||||
uses: mathieudutour/github-tag-action@v6.2
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
tag_prefix : ""
|
||||
custom_tag : ${{ steps.retag.outputs.tag }}
|
||||
|
||||
|
||||
- name: Create GitHub Release
|
||||
uses: actions/create-release@v1
|
||||
id: create_release
|
||||
with:
|
||||
tag_name: ${{ steps.tag_version.outputs.new_tag }}
|
||||
release_name: Release ${{ steps.tag_version.outputs.new_tag }}
|
||||
tag_name: ${{ steps.calculate_tag.outputs.new_tag }}
|
||||
release_name: Release ${{ steps.calculate_tag.outputs.new_tag }}
|
||||
draft: true
|
||||
body_path: release_notes.txt
|
||||
prerelease: ${{ inputs.release_candidate }}
|
||||
|
||||
Reference in New Issue
Block a user