Skip to content

Commit

Permalink
(feat: Update release handling for QueQiao project to include release…
Browse files Browse the repository at this point in the history
… notes and conditional deletion)
  • Loading branch information
17TheWord committed Aug 12, 2024
1 parent c1d4482 commit 99612bb
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 51 deletions.
43 changes: 42 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,45 @@ env:
GH_TOKEN: ${{ github.token }}

jobs:
create-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Read version.txt and save to variable
shell: pwsh
run: |
$mod_version = Get-Content version.txt
Write-Host "Version: $mod_version"
echo "MOD_VERSION=$mod_version" | Out-File -Append -Encoding utf8 -FilePath $env:GITHUB_ENV
- name: Check if Release exists
id: check-release
run: |
# Check if the release exists
RESPONSE=$(gh release view v${{ env.MOD_VERSION }} -R ${{ github.repository }} 2>&1 || true)
if echo "$RESPONSE" | grep -q "Not Found"; then
echo "Release v${{ env.MOD_VERSION }} does not exist. Skipping deletion."
echo "RELEASE_EXISTS=false" >> $GITHUB_ENV
else
echo "Release v${{ env.MOD_VERSION }} exists."
echo "RELEASE_EXISTS=true" >> $GITHUB_ENV
fi
- name: Delete Release if exists
if: env.RELEASE_EXISTS == 'true'
run: |
# Try to delete the release and handle errors gracefully
set +e
gh release delete v${{ env.MOD_VERSION }} -R ${{ github.repository }} -y --cleanup-tag
if [ $? -eq 0 ]; then
echo "Release v${{ env.MOD_VERSION }} deleted successfully."
else
echo "Failed to delete release v${{ env.MOD_VERSION }}. It might not exist or there might be another issue."
fi
- name: Create Release with temp note
run: gh release create v${{ env.MOD_VERSION }} --generate-notes

generate-matrix:
runs-on: windows-latest
outputs:
Expand All @@ -24,7 +63,9 @@ jobs:
build:
runs-on: windows-latest
needs: generate-matrix
needs:
- create-release
- generate-matrix
strategy:
matrix: ${{ fromJson(needs.generate-matrix.outputs.matrix) }}
steps:
Expand Down
50 changes: 0 additions & 50 deletions .github/workflows/release.yml

This file was deleted.

0 comments on commit 99612bb

Please sign in to comment.