Updated tagging
This commit is contained in:
@@ -36,23 +36,50 @@ jobs:
|
|||||||
python3 SpearheadCompile.py . ./output/spearhead.lua
|
python3 SpearheadCompile.py . ./output/spearhead.lua
|
||||||
|
|
||||||
- name: Calculate Tag
|
- name: Calculate Tag
|
||||||
id: tag_version_dry
|
id: calculate_tag
|
||||||
uses: mathieudutour/github-tag-action@v6.2
|
run: |
|
||||||
with:
|
# Get latest tag with 'v' prefix
|
||||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
latest_tag=$(git tag --sort=-v:refname | grep -E '^v' | head -n 1)
|
||||||
default_bump: ${{ inputs.change_size }}
|
if [ -z "$latest_tag" ]; then
|
||||||
custom_release_rules: ""
|
latest_tag="v0.0.0"
|
||||||
dry_run: true
|
fi
|
||||||
append_to_pre_release_tag: "rc"
|
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
|
- name: Check for existing tag
|
||||||
id: check_tag
|
id: check_tag
|
||||||
run: |
|
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."
|
echo "Tag already exists. Exiting."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
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
|
- name: Generate Release Notes
|
||||||
id: generate_release_notes
|
id: generate_release_notes
|
||||||
run: |
|
run: |
|
||||||
@@ -65,31 +92,12 @@ jobs:
|
|||||||
cat release_notes.txt
|
cat release_notes.txt
|
||||||
shell: bash
|
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
|
- name: Create GitHub Release
|
||||||
uses: actions/create-release@v1
|
uses: actions/create-release@v1
|
||||||
id: create_release
|
id: create_release
|
||||||
with:
|
with:
|
||||||
tag_name: ${{ steps.tag_version.outputs.new_tag }}
|
tag_name: ${{ steps.calculate_tag.outputs.new_tag }}
|
||||||
release_name: Release ${{ steps.tag_version.outputs.new_tag }}
|
release_name: Release ${{ steps.calculate_tag.outputs.new_tag }}
|
||||||
draft: true
|
draft: true
|
||||||
body_path: release_notes.txt
|
body_path: release_notes.txt
|
||||||
prerelease: ${{ inputs.release_candidate }}
|
prerelease: ${{ inputs.release_candidate }}
|
||||||
|
|||||||
Reference in New Issue
Block a user