Skip to content

Commit

Permalink
feat: build macos-helper
Browse files Browse the repository at this point in the history
  • Loading branch information
rxri committed Jul 21, 2024
1 parent f3fe37e commit a7eaaa4
Show file tree
Hide file tree
Showing 9 changed files with 172 additions and 278 deletions.
36 changes: 0 additions & 36 deletions .github/actions/release/linux/action.yml

This file was deleted.

40 changes: 0 additions & 40 deletions .github/actions/release/macos/action.yml

This file was deleted.

45 changes: 0 additions & 45 deletions .github/actions/release/windows/action.yml

This file was deleted.

40 changes: 40 additions & 0 deletions .github/workflows/release-linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Release (Linux)

on:
release:
types: [published]

jobs:
build:
permissions:
id-token: write
contents: write
attestations: write
name: Release (Linux)
strategy:
matrix:
arch: ["amd64", "arm64"]
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v3')
steps:
- name: Set Tag in env
run: echo "tag=${GITHUB_REF#refs/*/v}" >> "$GITHUB_ENV"
- name: Checkout
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: "go.mod"
- name: Build
shell: bash
run: |
mkdir dist
go build -o dist/spicetify-${{ env.tag }}-linux-${{ matrix.arch }} -ldflags "-X main.version=${{ env.tag }}"
env:
GOARCH: ${{ matrix.arch }}
- name: Upload artifact to release
uses: softprops/action-gh-release@v2
with:
files: "dist/*"
env:
GITHUB_TOKEN: ${{ inputs.GH_TOKEN }}
71 changes: 71 additions & 0 deletions .github/workflows/release-macos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Release (macOS)

on:
release:
types: [published]

jobs:
build:
permissions:
id-token: write
contents: write
attestations: write
name: Release (macOS)
strategy:
matrix:
arch: ["amd64", "arm64"]
runs-on: macos-latest
if: startsWith(github.ref, 'refs/tags/v3')
steps:
- name: Set Tag in env
run: echo "tag=${GITHUB_REF#refs/*/v}" >> "$GITHUB_ENV"
- name: Checkout
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: "go.mod"
- name: Build
shell: bash
run: |
mkdir dist
go build -o dist/spicetify-${{ matrix.arch }} -ldflags "-X main.version=${{ env.tag }}"
env:
GOARCH: ${{ matrix.arch }}
- name: Upload macOS artifact
uses: actions/upload-artifact@v4
with:
name: spicetify-${{ matrix.arch }}
path: dist/spicetify-${{ matrix.arch }}

combine-release:
name: Combine macOS release
needs: [build]
runs-on: macos-latest
steps:
- name: Set Tag in env
run: echo "tag=${GITHUB_REF#refs/*/v}" >> "$GITHUB_ENV"
- name: Checkout
uses: actions/checkout@v4
- shell: bash
run: mkdir dist
- name: Download macOS artifacts
uses: actions/download-artifact@v4
with:
path: artifacts/
merge-multiple: true
- name: Combine releases
shell: bash
run: |
set -e
brew install create-dmg
cd build/macos
chmod +x build.sh
./build.sh ${{ env.tag }}
mv spicetify.dmg ../../dist/spicetify-${{ env.tag }}.dmg
- name: Upload artifact to release
uses: softprops/action-gh-release@v2
with:
files: "dist/*"
env:
GITHUB_TOKEN: ${{ inputs.GH_TOKEN }}
51 changes: 51 additions & 0 deletions .github/workflows/release-windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Release (Windows)

on:
release:
types: [published]

jobs:
build:
permissions:
id-token: write
contents: write
attestations: write
name: Release (Windows)
strategy:
matrix:
arch: ["amd64", "arm64", "386"]
runs-on: windows-latest
if: startsWith(github.ref, 'refs/tags/v3')
steps:
- name: Set Tag in env
shell: pwsh
run: |
$version = $env:GITHUB_REF -replace 'refs/.*/v', ''
echo "tag=$version" >> $env:GITHUB_ENV
- name: Checkout
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: "go.mod"
- name: Setup Wix
shell: pwsh
run: |
$ErrorActionPreference = 'Stop'
dotnet tool install -g wix
wix extension add -g WixToolset.Util.wixext
wix extension add -g WixToolset.UI.wixext
- name: Build
shell: pwsh
run: |
$ErrorActionPreference = 'Stop'
mkdir dist
cd build\windows
.\build.ps1 -version ${{ env.tag }} -platform ${{ matrix.arch }}
mv spicetify.msi ..\..\dist\spicetify-${{ env.tag }}-${{ matrix.arch }}.msi
- name: Upload artifact to release
uses: softprops/action-gh-release@v2
with:
files: "dist/*"
env:
GITHUB_TOKEN: ${{ inputs.GH_TOKEN }}
58 changes: 0 additions & 58 deletions .github/workflows/release.yml

This file was deleted.

24 changes: 10 additions & 14 deletions build/macos/build.sh
Original file line number Diff line number Diff line change
@@ -1,21 +1,17 @@
#!/usr/bin/env sh
set -e

version=$1
mkdir Volume && mkdir -p bin
lipo -create -output bin/spicetify ../../artifacts/spicetify-amd64 ../../artifacts/spicetify-arm64 && echo "Built universal binary"

mkdir Volume
osacompile -x -o Volume/Spicetify.app main.applescript
rm Volume/Spicetify.app/Contents/Resources/applet.icns
cp installer/AppIcon.icns Volume/Spicetify.app/Contents/Resources/AppIcon.icns

GOARCH="amd64" go build -C ../../ -o build/macos/spicetify-amd64 -ldflags "-X main.version=$version"
GOARCH="arm64" go build -C ../../ -o build/macos/spicetify-arm64 -ldflags "-X main.version=$version"
mkdir -p Volume/Spicetify.app/Contents/MacOS/bin
lipo -create -output Volume/Spicetify.app/Contents/MacOS/bin/spicetify spicetify-amd64 spicetify-arm64

plutil -replace CFBundleName -string "Spicetify" Volume/Spicetify.app/Contents/Info.plist
plutil -replace CFBundleIconFile -string AppIcon.icns Volume/Spicetify.app/Contents/Info.plist
plutil -replace CFBundleURLTypes -xml '<array><dict><key>CFBundleURLName</key><string>Spicetify</string><key>CFBundleURLSchemes</key><array><string>spicetify</string></array></dict></array>' Volume/Spicetify.app/Contents/Info.plist
# Build the helper app with xcode
git clone https://github.com/rxri/spicetify-macos-helper.git
cd spicetify-macos-helper
cp -r ../bin spicetify/bin
sudo xcode-select -s /Applications/Xcode_15.4.app/Contents/Developer
xcodebuild -project spicetify.xcodeproj -scheme spicetify -configuration Release build SYMROOT="$(pwd)/build"
cp -r build/Release/spicetify.app ../Volume/Spicetify.app
cd ..

codesign --deep --force --sign - --timestamp=none Volume/Spicetify.app

Expand Down
Loading

0 comments on commit a7eaaa4

Please sign in to comment.