Skip to content

Release 0.8.11

Release 0.8.11 #119

Workflow file for this run

name: Release Build
on:
push:
tags:
- "v*.*.*"
workflow_dispatch:
permissions:
contents: write
concurrency:
group: release-${{ github.ref }}
cancel-in-progress: true
jobs:
build-release:
runs-on: macos-15
steps:
- name: Checkout
uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Resolve version
id: version
shell: bash
run: |
if [[ "${GITHUB_REF_TYPE:-}" == "tag" ]]; then
VERSION="${GITHUB_REF_NAME#v}"
else
VERSION="$(/usr/libexec/PlistBuddy -c 'Print :CFBundleShortVersionString' AIUsage/Info.plist)"
fi
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
echo "Resolved version: ${VERSION}"
- name: Validate version matches project
shell: bash
run: |
PLIST_SHORT="$(/usr/libexec/PlistBuddy -c 'Print :CFBundleShortVersionString' AIUsage/Info.plist)"
PLIST_BUILD="$(/usr/libexec/PlistBuddy -c 'Print :CFBundleVersion' AIUsage/Info.plist)"
PBXPROJ_VERSION="$(grep 'MARKETING_VERSION = ' AIUsage.xcodeproj/project.pbxproj | head -1 | sed 's/.*= *//;s/ *;.*//')"
TAG_VERSION="${{ steps.version.outputs.version }}"
echo "Tag: $TAG_VERSION"
echo "ShortVersionString: $PLIST_SHORT"
echo "BundleVersion: $PLIST_BUILD"
echo "MARKETING_VERSION: $PBXPROJ_VERSION"
FAIL=0
if [[ "$PLIST_SHORT" != "$TAG_VERSION" ]]; then echo "MISMATCH: CFBundleShortVersionString"; FAIL=1; fi
if [[ "$PLIST_BUILD" != "$TAG_VERSION" ]]; then echo "MISMATCH: CFBundleVersion"; FAIL=1; fi
if [[ "$PBXPROJ_VERSION" != "$TAG_VERSION" ]]; then echo "MISMATCH: MARKETING_VERSION"; FAIL=1; fi
if [[ $FAIL -ne 0 ]]; then exit 1; fi
- name: Resolve SPM dependencies
shell: bash
run: |
xcodebuild -project AIUsage.xcodeproj -scheme AIUsage \
-destination "platform=macOS" \
-resolvePackageDependencies \
-derivedDataPath build/DerivedData
- name: Build macOS release artifacts
shell: bash
env:
SPARKLE_EDDSA_PRIVATE_KEY: ${{ secrets.SPARKLE_EDDSA_PRIVATE_KEY }}
REQUIRE_SPARKLE_SIGNING: "1"
run: |
SPARKLE_TOOL="$(find build/DerivedData/SourcePackages/artifacts -name sign_update -path '*/bin/sign_update' | head -1)"
export SPARKLE_SIGN_TOOL="${SPARKLE_TOOL}"
./scripts/package-release.sh "${{ steps.version.outputs.version }}"
- name: Upload build artifacts
uses: actions/upload-artifact@v6
with:
name: AIUsage-${{ steps.version.outputs.version }}-macOS
path: |
dist/AIUsage-${{ steps.version.outputs.version }}-macOS.zip
dist/AIUsage-${{ steps.version.outputs.version }}-macOS.dmg
if-no-files-found: error
- name: Publish GitHub Release
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v3
with:
tag_name: ${{ github.ref_name }}
generate_release_notes: true
files: |
dist/AIUsage-${{ steps.version.outputs.version }}-macOS.zip
dist/AIUsage-${{ steps.version.outputs.version }}-macOS.dmg
- name: Update appcast.xml in repository
if: startsWith(github.ref, 'refs/tags/') && hashFiles('dist/appcast.xml') != ''
shell: bash
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git fetch origin main --depth=1
git checkout FETCH_HEAD
cp dist/appcast.xml appcast.xml
git add appcast.xml
git diff --cached --quiet && { echo "No appcast changes"; exit 0; }
git commit -m "Update appcast.xml for ${{ github.ref_name }}"
git push origin HEAD:main
- name: Verify appcast version
if: startsWith(github.ref, 'refs/tags/') && hashFiles('dist/appcast.xml') != ''
shell: bash
run: |
EXPECTED="${{ steps.version.outputs.version }}"
grep -q "<sparkle:shortVersionString>${EXPECTED}</sparkle:shortVersionString>" dist/appcast.xml
grep -q "<sparkle:version>${EXPECTED}</sparkle:version>" dist/appcast.xml
echo "Appcast verified: version ${EXPECTED}"