diff --git a/.github/workflows/prep-release.yaml b/.github/workflows/prep-release.yaml index 4c3597c..e11eb94 100644 --- a/.github/workflows/prep-release.yaml +++ b/.github/workflows/prep-release.yaml @@ -35,7 +35,6 @@ jobs: runs-on: ubuntu-latest permissions: contents: write - # ADD THIS SECTION outputs: sha: ${{ steps.get_sha.outputs.sha }} @@ -44,7 +43,6 @@ jobs: with: ref: main - # ADD THIS STEP - name: Get Commit SHA id: get_sha run: echo "sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT @@ -53,11 +51,23 @@ jobs: env: RELEASE_TAG: ${{ inputs.release || env.RELEASE }} run: | - # ... (Same deletion logic as before) ... - - # ... (Same creation logic) ... + echo "Processing release for: $RELEASE_TAG" + + # 1. CLEANUP: Check if the release/tag exists and nukes it. + # This ensures the 'dev' tag is free to move to the new commit. + if gh release view "$RELEASE_TAG" > /dev/null 2>&1; then + echo "Existing release found. Deleting '$RELEASE_TAG' to update pointer..." + gh release delete "$RELEASE_TAG" --cleanup-tag -y + else + echo "No existing release for '$RELEASE_TAG'. Creating new one." + fi + + # 2. CREATE: Create the release pointing to the latest commit (target main). + echo "Creating release..." gh release create "$RELEASE_TAG" \ --prerelease \ --target "${{ steps.get_sha.outputs.sha }}" \ --title "$RELEASE_TAG build" \ - --generate-notes \ No newline at end of file + --generate-notes + + echo "Success: $RELEASE_TAG updated to latest commit." \ No newline at end of file