Fixed clean up step
Nightly Build and Release / Build and Release Nightly (push) Failing after 1m25s
Nightly Build and Release / Build and Release Nightly (push) Failing after 1m25s
This commit is contained in:
@@ -31,20 +31,20 @@ jobs:
|
|||||||
- name: 'Execute .NET Publish Target'
|
- name: 'Execute .NET Publish Target'
|
||||||
run: dotnet build aeqw89.tools.Publish/aeqw89.tools.Publish.csproj -p:ArchiveVersion=nightly -t:Archive
|
run: dotnet build aeqw89.tools.Publish/aeqw89.tools.Publish.csproj -p:ArchiveVersion=nightly -t:Archive
|
||||||
|
|
||||||
# NEW STEP: Nuke the old release so the next step always runs on a clean slate
|
|
||||||
- name: Clean up previous Nightly Release
|
- name: Clean up previous Nightly Release
|
||||||
run: |
|
run: |
|
||||||
# 1. Ask the Gitea API for the internal ID of the 'nightly' release
|
# 1. Ask the Gitea API for the release (jq makes extracting the ID perfectly safe)
|
||||||
RELEASE_JSON=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" ${{ github.api_url }}/repos/${{ github.repository }}/releases/tags/nightly)
|
RELEASE_ID=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" ${{ github.api_url }}/repos/${{ github.repository }}/releases/tags/nightly | jq -r '.id')
|
||||||
RELEASE_ID=$(echo "$RELEASE_JSON" | grep -o '"id": *[0-9]*' | head -n 1 | awk '{print $2}')
|
|
||||||
|
|
||||||
# 2. If it found one, tell Gitea to delete the release and all its assets
|
# 2. If jq finds a valid ID, delete it
|
||||||
if [ -n "$RELEASE_ID" ]; then
|
if [ "$RELEASE_ID" != "null" ] && [ -n "$RELEASE_ID" ]; then
|
||||||
echo "Deleting old release ID: $RELEASE_ID"
|
echo "Deleting old release ID: $RELEASE_ID"
|
||||||
curl -s -X DELETE -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" ${{ github.api_url }}/repos/${{ github.repository }}/releases/$RELEASE_ID
|
curl -s -X DELETE -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" ${{ github.api_url }}/repos/${{ github.repository }}/releases/$RELEASE_ID
|
||||||
|
else
|
||||||
|
echo "No existing nightly release found to delete."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# 3. Delete the tag from the repository itself
|
# 3. Delete the Git tag
|
||||||
git push --delete origin nightly || true
|
git push --delete origin nightly || true
|
||||||
|
|
||||||
- name: Update Nightly Release
|
- name: Update Nightly Release
|
||||||
|
|||||||
Reference in New Issue
Block a user