Skip to content

refactor: streamline release process by consolidating DMG upload steps #14

refactor: streamline release process by consolidating DMG upload steps

refactor: streamline release process by consolidating DMG upload steps #14

Workflow file for this run

name: CI
on:
push:
branches: [ main, master ]
tags: ['v*']
pull_request:
branches: [ main, master ]
jobs:
build-and-test:
name: Build and Test
runs-on: macos-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Cache Swift packages
uses: actions/cache@v4
with:
path: |
.build
.build/checkouts
.build/reports
.swiftpm
key: ${{ runner.os }}-swift-${{ hashFiles('Package.resolved') }}
restore-keys: |
${{ runner.os }}-swift-
- name: Show Swift version
run: swift --version
- name: Build
run: swift build
- name: Test
run: swift test --verbose || true
release:
name: Release on Tag
runs-on: macos-latest
if: startsWith(github.ref, 'refs/tags/')
needs: build-and-test
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Show Swift version
run: swift --version
- name: Clean build folder
# Guarantees SPM doesn't use old cached files
run: make clean
- name: Build .app bundle
run: make app
- name: Verify Universal Binary
run: |
echo "Checking architecture of the compiled binary..."
BINARY_PATH="build/ScreenPrankLocker.app/Contents/MacOS/ScreenPrankLocker"
lipo -info "$BINARY_PATH"
if ! lipo -info "$BINARY_PATH" | grep -q "x86_64"; then
echo "Error: Missing x86_64 (Intel) architecture!"
exit 1
fi
if ! lipo -info "$BINARY_PATH" | grep -q "arm64"; then
echo "Error: Missing arm64 (Apple Silicon) architecture!"
exit 1
fi
echo "Success: Binary is universally fat and ready to pack!"
- name: Build DMG
run: make dmg
- name: Upload DMG as artifact
uses: actions/upload-artifact@v4
with:
name: screenpranklocker-dmg
path: build/*.dmg
- name: Create GitHub Release and Upload Asset
uses: softprops/action-gh-release@v2
with:
# This action handles wildcards directly, making things much cleaner
files: build/*.dmg
name: Release ${{ github.ref_name }}
body: "Automated release built by CI"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}