Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:

- name: Generate app token
id: app-token
uses: actions/create-github-app-token@v2
uses: actions/create-github-app-token@v3
with:
app-id: ${{ secrets.RELEASE_APP_ID }}
private-key: ${{ secrets.RELEASE_APP_PRIVATE_KEY }}
Expand All @@ -46,7 +46,21 @@ jobs:
echo "prerelease=false" >> "$GITHUB_OUTPUT"
fi

- name: Check if release already exists
id: check-release
env:
GH_TOKEN: ${{ github.token }}
run: |
VERSION="${{ steps.version.outputs.version }}"
if gh release view "$VERSION" > /dev/null 2>&1; then
echo "Release $VERSION already exists, skipping."
echo "exists=true" >> "$GITHUB_OUTPUT"
else
echo "exists=false" >> "$GITHUB_OUTPUT"
fi

- name: Validate version matches branch
if: steps.check-release.outputs.exists == 'false'
run: |
BRANCH="${{ inputs.branch || github.event.workflow_run.head_branch }}"
VERSION="${{ steps.version.outputs.version }}"
Expand Down Expand Up @@ -74,6 +88,7 @@ jobs:
# ruleset, so no git write happens in this workflow. --generate-notes
# below produces the GitHub release body.
- name: Create release
if: steps.check-release.outputs.exists == 'false'
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
run: |
Expand Down