Skip to content

fix: Resolve compilation errors in UpdateManager and logging imports #32

fix: Resolve compilation errors in UpdateManager and logging imports

fix: Resolve compilation errors in UpdateManager and logging imports #32

name: Build and Release
on:
push:
tags:
- 'v*'
workflow_dispatch:
jobs:
build:
runs-on: macos-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable
- name: Build Release
run: |
chmod +x Scripts/build_release.sh
./Scripts/build_release.sh
- name: Create DMG
run: |
chmod +x Scripts/create_dmg.sh
./Scripts/create_dmg.sh
- name: Upload DMG
uses: actions/upload-artifact@v4
with:
name: AudioKeeper-DMG
path: "*.dmg"
- name: Create Release
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v1
with:
files: "*.dmg"
generate_release_notes: true
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Update Homebrew Formula
if: startsWith(github.ref, 'refs/tags/')
run: |
# Extract version from tag (remove 'v' prefix)
VERSION=${GITHUB_REF#refs/tags/v}
# Wait a bit for release to be fully published
sleep 30
# Calculate SHA256 of the DMG file
DMG_SHA256=$(shasum -a 256 *.dmg | cut -d' ' -f1)
# Checkout main branch
git fetch origin main
git checkout main
# Update the formula file
sed -i '' "s/version \"[^\"]*\"/version \"${VERSION}\"/" audiokeeper.rb
sed -i '' "s/sha256 \"[^\"]*\"/sha256 \"${DMG_SHA256}\"/" audiokeeper.rb
# Commit and push changes
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add audiokeeper.rb
git diff --staged --quiet || git commit -m "chore: Auto-update Homebrew formula to v${VERSION}"
git push origin main