diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d12e084..c82e4c4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -71,6 +71,16 @@ jobs: env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: gh release upload "${{ needs.release-please.outputs.tag_name }}" patchloom.vsix + - name: Apply custom release notes + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + if [ -f RELEASE_NOTES.md ]; then + echo "Custom release notes found, updating release body..." + gh release edit "${{ needs.release-please.outputs.tag_name }}" --notes-file RELEASE_NOTES.md + else + echo "No custom release notes, using auto-generated notes" + fi # See ~/.grok/skills/vsce-publish/SKILL.md (or /vsce-publish) for the full # one-time browser setup (aex.dev.azure.com, PAT scopes, Open VSX agreement # + create-namespace + ownership claim), secret names, and troubleshooting. @@ -97,3 +107,34 @@ jobs: color: blue namedLogo: visualstudiocode logoColor: white + # Clean up RELEASE_NOTES.md after release (uses App token so the PR triggers CI/auto-approve) + - uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0 + if: hashFiles('RELEASE_NOTES.md') != '' + id: cleanup-token + with: + client-id: ${{ vars.APP_CLIENT_ID }} + private-key: ${{ secrets.APP_PRIVATE_KEY }} + - name: Clean up release notes file + if: steps.cleanup-token.outcome == 'success' + env: + GH_TOKEN: ${{ steps.cleanup-token.outputs.token }} + run: | + if git ls-tree HEAD --name-only | grep -q '^RELEASE_NOTES.md$'; then + TAG="${{ needs.release-please.outputs.tag_name }}" + BRANCH="chore/cleanup-release-notes-${TAG}" + gh api "repos/${{ github.repository }}/git/refs" \ + -f ref="refs/heads/$BRANCH" \ + -f sha="$(git rev-parse HEAD)" + FILE_SHA=$(gh api \ + "repos/${{ github.repository }}/contents/RELEASE_NOTES.md?ref=$BRANCH" \ + --jq '.sha') + gh api --method DELETE \ + "repos/${{ github.repository }}/contents/RELEASE_NOTES.md" \ + -f message="chore: remove release notes override" \ + -f sha="$FILE_SHA" \ + -f branch="$BRANCH" + PR_URL=$(gh pr create --base main --head "$BRANCH" \ + --title "chore: remove release notes override" \ + --body "Auto-cleanup after ${TAG} release.") + gh pr merge "$PR_URL" --auto --squash + fi