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
|
runs-on: self-hosted
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
# 1. Checkout repository
|
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
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
|
- name: Check/Create Tag
|
||||||
id: tag
|
id: tag
|
||||||
run: |
|
run: |
|
||||||
VERSION=$(cat VERSION | tr -d '[:space:]') # read version and trim whitespace
|
VERSION=$(cat VERSION | tr -d '[:space:]') # read version and trim whitespace
|
||||||
echo "Version: $VERSION"
|
echo "Version: $VERSION"
|
||||||
|
|
||||||
# if git rev-parse "v$VERSION" >/dev/null 2>&1; then
|
if git rev-parse "v$VERSION" >/dev/null 2>&1; then
|
||||||
tags=$(git tag -l "v$(cat VERSION)" | wc -l)
|
|
||||||
if [[ $tags == "1" ]]; then
|
|
||||||
echo "Tag v$VERSION already exists. Skipping release."
|
echo "Tag v$VERSION already exists. Skipping release."
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
@@ -35,7 +34,6 @@ jobs:
|
|||||||
|
|
||||||
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
# 3. Build artifacts (only runs if tag did not exist)
|
|
||||||
- name: Build Artifacts
|
- name: Build Artifacts
|
||||||
if: steps.tag.outputs.version
|
if: steps.tag.outputs.version
|
||||||
run: |
|
run: |
|
||||||
@@ -43,7 +41,6 @@ jobs:
|
|||||||
./package
|
./package
|
||||||
ls -l dist/
|
ls -l dist/
|
||||||
|
|
||||||
# 4. Create release
|
|
||||||
- name: Create Release
|
- name: Create Release
|
||||||
if: steps.tag.outputs.version
|
if: steps.tag.outputs.version
|
||||||
id: create_release
|
id: create_release
|
||||||
@@ -65,7 +62,6 @@ jobs:
|
|||||||
RELEASE_ID=$(echo $RESPONSE | jq -r '.id')
|
RELEASE_ID=$(echo $RESPONSE | jq -r '.id')
|
||||||
echo "release_id=$RELEASE_ID" >> $GITHUB_OUTPUT
|
echo "release_id=$RELEASE_ID" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
# 5. Upload artifacts
|
|
||||||
- name: Upload Artifacts
|
- name: Upload Artifacts
|
||||||
if: steps.tag.outputs.version
|
if: steps.tag.outputs.version
|
||||||
run: |
|
run: |
|
||||||
@@ -80,7 +76,6 @@ jobs:
|
|||||||
"https://git.thewizardapprentice.com/api/v1/repos/${{ gitea.repository }}/releases/$RELEASE_ID/assets?name=$FILENAME"
|
"https://git.thewizardapprentice.com/api/v1/repos/${{ gitea.repository }}/releases/$RELEASE_ID/assets?name=$FILENAME"
|
||||||
done
|
done
|
||||||
|
|
||||||
# 6. Cleanup artifacts
|
|
||||||
- name: Cleanup
|
- name: Cleanup
|
||||||
if: steps.tag.outputs.version
|
if: steps.tag.outputs.version
|
||||||
run: rm -rf dist/*
|
run: rm -rf dist/*
|
||||||
|
|||||||
Reference in New Issue
Block a user