Ensure all tags are fetched when checking out the repo
All checks were successful
Release / release (push) Successful in 3s
All checks were successful
Release / release (push) Successful in 3s
This commit is contained in:
@@ -10,20 +10,19 @@ jobs:
|
||||
runs-on: self-hosted
|
||||
|
||||
steps:
|
||||
# 1. Checkout repository
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0 # fetch full history
|
||||
tags: true # fetch all tags
|
||||
|
||||
# 2. Read VERSION file and check if tag exists
|
||||
- name: Check/Create Tag
|
||||
id: tag
|
||||
run: |
|
||||
VERSION=$(cat VERSION | tr -d '[:space:]') # read version and trim whitespace
|
||||
echo "Version: $VERSION"
|
||||
|
||||
# if git rev-parse "v$VERSION" >/dev/null 2>&1; then
|
||||
tags=$(git tag -l "v$(cat VERSION)" | wc -l)
|
||||
if [[ $tags == "1" ]]; then
|
||||
if git rev-parse "v$VERSION" >/dev/null 2>&1; then
|
||||
echo "Tag v$VERSION already exists. Skipping release."
|
||||
exit 0
|
||||
fi
|
||||
@@ -35,7 +34,6 @@ jobs:
|
||||
|
||||
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
||||
|
||||
# 3. Build artifacts (only runs if tag did not exist)
|
||||
- name: Build Artifacts
|
||||
if: steps.tag.outputs.version
|
||||
run: |
|
||||
@@ -43,7 +41,6 @@ jobs:
|
||||
./package
|
||||
ls -l dist/
|
||||
|
||||
# 4. Create release
|
||||
- name: Create Release
|
||||
if: steps.tag.outputs.version
|
||||
id: create_release
|
||||
@@ -65,7 +62,6 @@ jobs:
|
||||
RELEASE_ID=$(echo $RESPONSE | jq -r '.id')
|
||||
echo "release_id=$RELEASE_ID" >> $GITHUB_OUTPUT
|
||||
|
||||
# 5. Upload artifacts
|
||||
- name: Upload Artifacts
|
||||
if: steps.tag.outputs.version
|
||||
run: |
|
||||
@@ -80,7 +76,6 @@ jobs:
|
||||
"https://git.thewizardapprentice.com/api/v1/repos/${{ gitea.repository }}/releases/$RELEASE_ID/assets?name=$FILENAME"
|
||||
done
|
||||
|
||||
# 6. Cleanup artifacts
|
||||
- name: Cleanup
|
||||
if: steps.tag.outputs.version
|
||||
run: rm -rf dist/*
|
||||
|
||||
Reference in New Issue
Block a user