Refactor release workflow to improve validation and note handling

- Renamed the job from 'create-release' to 'validate-and-prepare' to better reflect its purpose.
- Added a step to store release notes for later use, enhancing the release process.
- Updated dependencies in the build-release job to rely on the new validation job outputs.
- Improved the announcement step to utilize the validated tag name and release notes, ensuring clarity in release communications.
This commit is contained in:
scawful
2025-09-26 22:53:07 -04:00
parent 9b295d5d75
commit 84b83417e9

View File

@@ -17,11 +17,12 @@ env:
BUILD_TYPE: Release BUILD_TYPE: Release
jobs: jobs:
create-release: validate-and-prepare:
name: Create Release name: Validate Release
runs-on: ubuntu-latest runs-on: ubuntu-latest
outputs: outputs:
tag_name: ${{ env.VALIDATED_TAG }} tag_name: ${{ env.VALIDATED_TAG }}
release_notes: ${{ steps.notes.outputs.content }}
steps: steps:
- name: Validate tag format - name: Validate tag format
@@ -91,22 +92,17 @@ jobs:
echo "# Yaze $VERSION Release Notes\n\nPlease see the full changelog at docs/C1-changelog.md" > release_notes.md echo "# Yaze $VERSION Release Notes\n\nPlease see the full changelog at docs/C1-changelog.md" > release_notes.md
fi fi
- name: Create Release - name: Store release notes
id: create_release id: notes
uses: softprops/action-gh-release@v1 run: |
env: # Store release notes content for later use
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} echo "content<<EOF" >> $GITHUB_OUTPUT
with: cat release_notes.md >> $GITHUB_OUTPUT
tag_name: ${{ env.VALIDATED_TAG }} echo "EOF" >> $GITHUB_OUTPUT
name: Yaze ${{ env.VALIDATED_TAG }}
body_path: release_notes.md
draft: false
prerelease: ${{ contains(env.VALIDATED_TAG, 'beta') || contains(env.VALIDATED_TAG, 'alpha') || contains(env.VALIDATED_TAG, 'rc') }}
generate_release_notes: true
build-release: build-release:
name: Build Release name: Build Release
needs: create-release needs: validate-and-prepare
strategy: strategy:
matrix: matrix:
include: include:
@@ -159,7 +155,7 @@ jobs:
cp LICENSE dmg_staging/ cp LICENSE dmg_staging/
cp README.md dmg_staging/ cp README.md dmg_staging/
cp -r docs dmg_staging/ cp -r docs dmg_staging/
hdiutil create -srcfolder dmg_staging -format UDZO -volname "Yaze ${{ needs.create-release.outputs.tag_name }}" yaze-macos.dmg hdiutil create -srcfolder dmg_staging -format UDZO -volname "Yaze ${{ needs.validate-and-prepare.outputs.tag_name }}" yaze-macos.dmg
- name: "Linux x64" - name: "Linux x64"
os: ubuntu-22.04 os: ubuntu-22.04
@@ -258,19 +254,24 @@ jobs:
shell: bash shell: bash
run: ${{ matrix.package_cmd }} run: ${{ matrix.package_cmd }}
# Upload to release # Create release with artifacts (will create release if it doesn't exist)
- name: Upload Release Asset - name: Upload to Release
uses: softprops/action-gh-release@v1 uses: softprops/action-gh-release@v1
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with: with:
tag_name: ${{ needs.create-release.outputs.tag_name }} tag_name: ${{ needs.validate-and-prepare.outputs.tag_name }}
name: Yaze ${{ needs.validate-and-prepare.outputs.tag_name }}
body: ${{ needs.validate-and-prepare.outputs.release_notes }}
draft: false
prerelease: ${{ contains(needs.validate-and-prepare.outputs.tag_name, 'beta') || contains(needs.validate-and-prepare.outputs.tag_name, 'alpha') || contains(needs.validate-and-prepare.outputs.tag_name, 'rc') }}
files: | files: |
${{ matrix.artifact_name }}.* ${{ matrix.artifact_name }}.*
fail_on_unmatched_files: true
publish-packages: publish-packages:
name: Publish Packages name: Publish Packages
needs: [create-release, build-release] needs: [validate-and-prepare, build-release]
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: success() if: success()
@@ -282,6 +283,6 @@ jobs:
- name: Announce release - name: Announce release
run: | run: |
echo "🎉 Yaze ${{ needs.create-release.outputs.tag_name }} has been released!" echo "🎉 Yaze ${{ needs.validate-and-prepare.outputs.tag_name }} has been released!"
echo "📦 Packages are now available for download" echo "📦 Packages are now available for download"
echo "🔗 Release URL: https://github.com/${{ github.repository }}/releases/tag/${{ needs.create-release.outputs.tag_name }}" echo "🔗 Release URL: https://github.com/${{ github.repository }}/releases/tag/${{ needs.validate-and-prepare.outputs.tag_name }}"