Files
wizarr/.github/workflows/create-release.yml
dependabot[bot] 4b5ef073fe build(deps): bump actions/checkout from 5 to 6
Bumps [actions/checkout](https://github.com/actions/checkout) from 5 to 6.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v5...v6)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-11-24 10:09:27 +00:00

78 lines
3.1 KiB
YAML

name: Create Release
on:
pull_request:
branches: [main]
types: [closed]
jobs:
create-release:
runs-on: blacksmith-2vcpu-ubuntu-2404
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@v6
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: |
# Save PR body to file to avoid shell injection
cat > pr_body.md << 'EOF'
${{ github.event.pull_request.body }}
EOF
# Extract changelog from PR body (remove the footer)
sed '/^---$/,$d' pr_body.md > 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