feat: Update CI/CD workflow for artifact handling and packaging

- Enhanced the release workflow to better manage artifacts for Windows, macOS, and Linux, ensuring correct paths and improved error handling.
- Added environment variable settings for package paths to streamline subsequent steps.
- Improved artifact size reporting based on successful builds, providing clearer feedback in the CI process.
- Refactored artifact download steps to organize and list release artifacts more effectively.
This commit is contained in:
scawful
2025-10-09 11:35:40 -04:00
parent 417816a854
commit 760bd5fd33

View File

@@ -287,26 +287,45 @@ jobs:
cp LICENSE README.md stage/ cp LICENSE README.md stage/
(cd stage && powershell -Command "Compress-Archive -Path * -DestinationPath ../${ARTIFACT_NAME}.zip") (cd stage && powershell -Command "Compress-Archive -Path * -DestinationPath ../${ARTIFACT_NAME}.zip")
echo "Created ${ARTIFACT_NAME}.zip" echo "Created ${ARTIFACT_NAME}.zip"
echo "PACKAGE_PATH=${ARTIFACT_NAME}.zip" >> "$GITHUB_ENV"
elif [[ "${{ runner.os }}" == "macOS" ]]; then elif [[ "${{ runner.os }}" == "macOS" ]]; then
# For macOS, we stage the .app bundle as a "slice" for the universal merge job # For macOS, we stage the .app bundle as a "slice" for the universal merge job
cp -R build/bin/yaze.app stage/ cp -R build/bin/yaze.app stage/yaze.app
echo "Staged yaze.app slice for ${ARTIFACT_NAME}" echo "Staged yaze.app slice for ${ARTIFACT_NAME}"
echo "PACKAGE_PATH=stage/" >> "$GITHUB_ENV"
else # Linux else # Linux
cp build/bin/yaze stage/ cp build/bin/yaze stage/
cp -r assets/ stage/assets/ cp -r assets/ stage/assets/
cp LICENSE README.md stage/ cp LICENSE README.md stage/
tar -czf "${ARTIFACT_NAME}.tar.gz" -C stage . tar -czf "${ARTIFACT_NAME}.tar.gz" -C stage .
echo "Created ${ARTIFACT_NAME}.tar.gz" echo "Created ${ARTIFACT_NAME}.tar.gz"
echo "PACKAGE_PATH=${ARTIFACT_NAME}.tar.gz" >> "$GITHUB_ENV"
fi fi
- name: "Upload Artifact" - name: "Upload Artifact (Windows)"
if: runner.os == 'Windows'
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: ${{ matrix.artifact_name }} name: ${{ matrix.artifact_name }}
path: | path: ${{ matrix.artifact_name }}.zip
${{ matrix.artifact_name }}.zip if-no-files-found: error
${{ matrix.artifact_name }}.tar.gz retention-days: 5
stage/
- name: "Upload Artifact (macOS)"
if: runner.os == 'macOS'
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact_name }}
path: stage/yaze.app
if-no-files-found: error
retention-days: 5
- name: "Upload Artifact (Linux)"
if: runner.os == 'Linux'
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact_name }}
path: ${{ matrix.artifact_name }}.tar.gz
if-no-files-found: error if-no-files-found: error
retention-days: 5 retention-days: 5
@@ -336,12 +355,18 @@ jobs:
echo "- ❌ Build: Failed" >> $GITHUB_STEP_SUMMARY echo "- ❌ Build: Failed" >> $GITHUB_STEP_SUMMARY
fi fi
if [[ "${{ runner.os }}" == "Windows" && -f "${{ matrix.artifact_name }}.zip" ]]; then # Show package size if build succeeded
SIZE=$(du -h "${{ matrix.artifact_name }}.zip" | cut -f1) if [[ "${{ steps.build.outcome }}" == "success" ]]; then
echo "- 📦 Artifact Size: $SIZE" >> $GITHUB_STEP_SUMMARY if [[ "${{ runner.os }}" == "Windows" && -f "${{ matrix.artifact_name }}.zip" ]]; then
elif [[ -f "${{ matrix.artifact_name }}.tar.gz" ]]; then SIZE=$(du -h "${{ matrix.artifact_name }}.zip" | cut -f1)
SIZE=$(du -h "${{ matrix.artifact_name }}.tar.gz" | cut -f1) echo "- 📦 Artifact Size: $SIZE" >> $GITHUB_STEP_SUMMARY
echo "- 📦 Artifact Size: $SIZE" >> $GITHUB_STEP_SUMMARY elif [[ "${{ runner.os }}" == "Linux" && -f "${{ matrix.artifact_name }}.tar.gz" ]]; then
SIZE=$(du -h "${{ matrix.artifact_name }}.tar.gz" | cut -f1)
echo "- 📦 Artifact Size: $SIZE" >> $GITHUB_STEP_SUMMARY
elif [[ "${{ runner.os }}" == "macOS" && -d "stage/yaze.app" ]]; then
SIZE=$(du -sh "stage/yaze.app" | cut -f1)
echo "- 📦 Artifact Size: $SIZE" >> $GITHUB_STEP_SUMMARY
fi
fi fi
# ====================================================================================== # ======================================================================================
@@ -368,9 +393,15 @@ jobs:
shell: bash shell: bash
run: | run: |
set -euo pipefail set -euo pipefail
# The artifacts are downloaded as yaze.app directly
ARM_APP="arm64-slice/yaze.app" ARM_APP="arm64-slice/yaze.app"
X64_APP="x86_64-slice/yaze.app" X64_APP="x86_64-slice/yaze.app"
echo "Checking downloaded artifacts..."
ls -la arm64-slice/
ls -la x86_64-slice/
# Use the arm64 bundle as the base # Use the arm64 bundle as the base
cp -R "${ARM_APP}" ./yaze.app cp -R "${ARM_APP}" ./yaze.app
@@ -399,14 +430,26 @@ jobs:
needs: [prepare-release, build-and-package, merge-macos-universal] needs: [prepare-release, build-and-package, merge-macos-universal]
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: "Download All Artifacts" - name: "Download Windows Artifact"
uses: actions/download-artifact@v4 uses: actions/download-artifact@v4
with: with:
path: dist name: yaze-windows-x64
merge-multiple: true path: release-artifacts
- name: "List Artifacts" - name: "Download Linux Artifact"
run: ls -lR dist uses: actions/download-artifact@v4
with:
name: yaze-linux-x64
path: release-artifacts
- name: "Download macOS Universal Artifact"
uses: actions/download-artifact@v4
with:
name: yaze-macos-universal
path: release-artifacts
- name: "List Release Artifacts"
run: ls -lR release-artifacts
- name: "Create/Update Release" - name: "Create/Update Release"
uses: softprops/action-gh-release@v2 uses: softprops/action-gh-release@v2
@@ -416,6 +459,6 @@ jobs:
body: ${{ needs.prepare-release.outputs.release_notes }} body: ${{ needs.prepare-release.outputs.release_notes }}
draft: false draft: false
prerelease: ${{ needs.prepare-release.outputs.is_prerelease }} prerelease: ${{ needs.prepare-release.outputs.is_prerelease }}
files: dist/* files: release-artifacts/*
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}