mirror of
https://github.com/wizarrrr/wizarr.git
synced 2026-06-12 07:44:46 -04:00
- Use --notes-file instead of --notes to avoid interpreting changelog content as shell commands - Resolves issue where commit hashes and special characters caused workflow failures
77 lines
3.1 KiB
YAML
77 lines
3.1 KiB
YAML
name: Create Release
|
|
|
|
on:
|
|
pull_request:
|
|
branches: [main]
|
|
types: [closed]
|
|
|
|
jobs:
|
|
create-release:
|
|
runs-on: ubuntu-latest
|
|
if: |
|
|
github.event.pull_request.merged == true &&
|
|
startsWith(github.event.pull_request.title, 'Release v') &&
|
|
github.repository_owner == 'wizarrrr'
|
|
permissions:
|
|
contents: write
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v5
|
|
with:
|
|
token: ${{ secrets.RELEASE_PLEASE_TOKEN || secrets.GITHUB_TOKEN }}
|
|
fetch-depth: 0
|
|
|
|
- name: Extract version from PR title
|
|
id: version
|
|
run: |
|
|
PR_TITLE="${{ github.event.pull_request.title }}"
|
|
VERSION=$(echo "$PR_TITLE" | sed 's/Release v//')
|
|
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
|
echo "tag=v$VERSION" >> $GITHUB_OUTPUT
|
|
|
|
- name: Create GitHub Release
|
|
id: create_release
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.RELEASE_PLEASE_TOKEN || secrets.GITHUB_TOKEN }}
|
|
run: |
|
|
# Extract changelog from PR body (remove the footer)
|
|
PR_BODY="${{ github.event.pull_request.body }}"
|
|
CHANGELOG=$(echo "$PR_BODY" | sed '/^---$/,$d')
|
|
|
|
# Save changelog to file to avoid shell injection
|
|
echo "$CHANGELOG" > changelog.md
|
|
|
|
# Create the release (explicitly published, not draft)
|
|
echo "Creating published release ${{ steps.version.outputs.tag }}..."
|
|
gh release create "${{ steps.version.outputs.tag }}" \
|
|
--title "${{ steps.version.outputs.tag }}" \
|
|
--notes-file changelog.md \
|
|
--latest
|
|
|
|
# Verify the release was published (not draft)
|
|
RELEASE_INFO=$(gh release view "${{ steps.version.outputs.tag }}" --json isDraft,url)
|
|
IS_DRAFT=$(echo "$RELEASE_INFO" | jq -r '.isDraft')
|
|
RELEASE_URL=$(echo "$RELEASE_INFO" | jq -r '.url')
|
|
|
|
if [[ "$IS_DRAFT" == "true" ]]; then
|
|
echo "❌ ERROR: Release was created as draft! This will not trigger wizarr-release workflow."
|
|
exit 1
|
|
else
|
|
echo "✅ Release successfully published and will trigger wizarr-release workflow"
|
|
fi
|
|
|
|
echo "html_url=$RELEASE_URL" >> $GITHUB_OUTPUT
|
|
|
|
- name: Summary
|
|
run: |
|
|
echo "🎉 **Release Created & Published!**" >> $GITHUB_STEP_SUMMARY
|
|
echo "" >> $GITHUB_STEP_SUMMARY
|
|
echo "- **Version**: ${{ steps.version.outputs.tag }}" >> $GITHUB_STEP_SUMMARY
|
|
echo "- **Release URL**: ${{ steps.create_release.outputs.html_url }}" >> $GITHUB_STEP_SUMMARY
|
|
echo "" >> $GITHUB_STEP_SUMMARY
|
|
echo "## What happens next:" >> $GITHUB_STEP_SUMMARY
|
|
echo "1. ⚙️ **wizarr-release** workflow is now triggered (Docker build)" >> $GITHUB_STEP_SUMMARY
|
|
echo "2. 📦 Docker images built for linux/amd64 and linux/arm64" >> $GITHUB_STEP_SUMMARY
|
|
echo "3. 🏷️ Images tagged as \`:latest\` and \`:${{ steps.version.outputs.version }}\`" >> $GITHUB_STEP_SUMMARY
|
|
echo "4. 🚀 Images pushed to ghcr.io/${{ github.repository_owner }}/wizarr" >> $GITHUB_STEP_SUMMARY |