feat: add notarization for apple #43
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release | ||
on: | ||
push: | ||
tags: | ||
- 'v*.*' | ||
permissions: | ||
contents: write | ||
jobs: | ||
build-linux: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
lfs: true | ||
- name: Set up Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: 1.22 | ||
- name: Install fyne-cross | ||
run: go install github.com/fyne-io/fyne-cross@latest | ||
- name: Cross-compile for Linux | ||
run: fyne-cross linux | ||
- name: Upload Linux artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: linux-build | ||
path: fyne-cross/bin/linux-amd64 | ||
build-windows: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
lfs: true | ||
- name: Set up Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: 1.22 | ||
- name: Install fyne-cross | ||
run: go install github.com/fyne-io/fyne-cross@latest | ||
- name: Cross-compile for Windows | ||
run: fyne-cross windows | ||
- name: Upload Windows artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: windows-build | ||
path: fyne-cross/bin/windows-amd64 | ||
build-mac: | ||
runs-on: macos-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
lfs: true | ||
- name: Set up Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: 1.22 | ||
- name: Compile for MacOS | ||
run: | | ||
GOOS=darwin GOARCH=arm64 go build -o SoundscapeSync_arm64 | ||
CGO_ENABLED=1 GOOS=darwin GOARCH=amd64 go build -o SoundscapeSync_amd64 | ||
lipo -create -output SoundscapeSync SoundscapeSync_amd64 SoundscapeSync_arm64 | ||
mkdir -p SoundscapeSync.app/Contents/MacOS | ||
mv SoundscapeSync SoundscapeSync.app/Contents/MacOS/SoundscapeSync | ||
echo '<?xml version="1.0" encoding="UTF-8"?>' > SoundscapeSync.app/Contents/Info.plist | ||
echo '<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">' >> SoundscapeSync.app/Contents/Info.plist | ||
echo '<plist version="1.0">' >> SoundscapeSync.app/Contents/Info.plist | ||
echo '<dict>' >> SoundscapeSync.app/Contents/Info.plist | ||
echo ' <key>CFBundleName</key>' >> SoundscapeSync.app/Contents/Info.plist | ||
echo ' <string>SoundscapeSync</string>' >> SoundscapeSync.app/Contents/Info.plist | ||
echo ' <key>CFBundleVersion</key>' >> SoundscapeSync.app/Contents/Info.plist | ||
echo ' <string>1.0</string>' >> SoundscapeSync.app/Contents/Info.plist | ||
echo ' <key>CFBundleIdentifier</key>' >> SoundscapeSync.app/Contents/Info.plist | ||
echo ' <string>com.cloonar.soundscape-sync</string>' >> SoundscapeSync.app/Contents/Info.plist | ||
echo ' <key>Executable</key>' >> SoundscapeSync.app/Contents/Info.plist | ||
echo ' <string>SoundscapeSync</string>' >> SoundscapeSync.app/Contents/Info.plist | ||
echo '</dict>' >> SoundscapeSync.app/Contents/Info.plist | ||
echo '</plist>' >> SoundscapeSync.app/Contents/Info.plist | ||
chmod +x SoundscapeSync.app/Contents/MacOS/SoundscapeSync | ||
- name: Install certificate | ||
env: | ||
MAC_CERT_P12: ${{ secrets.MAC_CERT_P12 }} | ||
MAC_CERT_P12_PASSWORD: ${{ secrets.MAC_CERT_P12_PASSWORD }} | ||
run: | | ||
mkdir -p ~/certs | ||
echo "$MAC_CERT_P12" | base64 --decode > ~/certs/mac_dev_cert.p12 | ||
security create-keychain -p "" build.keychain | ||
security import ~/certs/mac_dev_cert.p12 -k build.keychain -P "$MAC_CERT_P12_PASSWORD" -A | ||
security set-key-partition-list -S apple-tool:,apple: -s -k "" build.keychain | ||
security default-keychain -s build.keychain | ||
security unlock-keychain -p "" build.keychain | ||
- name: Sign App | ||
env: | ||
MAC_CERT_NAME: ${{ secrets.MAC_CERT_NAME }} | ||
run: | | ||
codesign --deep --force --options runtime --sign "$MAC_CERT_NAME" SoundscapeSync.app | ||
- name: Verify signature | ||
run: codesign --verify --deep --strict --verbose=2 SoundscapeSync.app | ||
- name: Zip macOS build | ||
run: zip -r SoundscapeSync.app.zip SoundscapeSync.app | ||
- name: Notarize App | ||
if: ${{ secrets.APPLE_ID && secrets.APPLE_TEAM_ID && secrets.APPLE_PASSWORD }} | ||
Check failure on line 104 in .github/workflows/release.yml GitHub Actions / ReleaseInvalid workflow file
Check failure on line 104 in .github/workflows/release.yml GitHub Actions / ReleaseInvalid workflow file
|
||
env: | ||
APPLE_ID: ${{ secrets.APPLE_ID }} | ||
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} | ||
APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }} | ||
run: | | ||
xcrun notarytool submit SoundscapeSync.app.zip --apple-id "$APPLE_ID" --team-id "$APPLE_TEAM_ID" --password "$APPLE_PASSWORD" --wait | ||
- name: Staple Notarization | ||
if: ${{ secrets.APPLE_ID && secrets.APPLE_TEAM_ID && secrets.APPLE_PASSWORD }} | ||
run: xcrun stapler staple SoundscapeSync.app | ||
- name: Re-zip macOS build | ||
if: ${{ secrets.APPLE_ID && secrets.APPLE_TEAM_ID && secrets.APPLE_PASSWORD }} | ||
run: zip -r SoundscapeSync.app.zip SoundscapeSync.app | ||
- name: Upload macOS artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: macos-build | ||
path: SoundscapeSync.app.zip | ||
create-release: | ||
runs-on: ubuntu-latest | ||
needs: [build-linux, build-windows, build-mac] | ||
steps: | ||
- name: Generate Changelog | ||
id: changelog | ||
uses: requarks/changelog-action@v1 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
tag: ${{ github.ref_name }} | ||
- name: Create Release | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ github.ref_name }} | ||
release_name: Release ${{ github.ref_name }} | ||
body: ${{ steps.changelog.outputs.changes }} | ||
draft: false | ||
prerelease: true | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
name: linux-build | ||
- name: Upload Linux Asset | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: soundscape-sync | ||
asset_name: soundscape-sync-linux-x86 | ||
asset_content_type: application/octet-stream | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
name: windows-build | ||
- name: Upload Windows Asset | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: SoundscapeSync.exe | ||
asset_name: SoundscapeSync.exe | ||
asset_content_type: application/x-msdownload | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
name: macos-build | ||
- name: Upload MacOS Asset | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: SoundscapeSync.app.zip | ||
asset_name: MacOS.zip | ||
asset_content_type: application/zip | ||
- name: Generate checksum | ||
uses: jmgilman/actions-generate-checksum@v1 | ||
with: | ||
patterns: | | ||
SoundscapeSync.exe | ||
SoundscapeSync.app.zip | ||
- name: Upload checksum | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: checksum.txt | ||
asset_name: checksum.txt | ||
asset_content_type: text/plain |