Add Apple ID and team ID secrets to build.yaml #56
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: cross-platform-build | |
on: | |
push: | |
branches: | |
- main | |
- dev | |
- tauri | |
pull_request: | |
branches: | |
- main | |
- dev | |
- tauri | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [macos-latest, ubuntu-latest, macos-13, windows-latest ] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- uses: pnpm/action-setup@v4 | |
name: Install pnpm | |
with: | |
version: 9 | |
run_install: false | |
- name: Install Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: 'pnpm' | |
- name: install Rust stable | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
# Those targets are only used on macos runners so it's in an `if` to slightly speed up windows and linux builds. | |
targets: ${{ matrix.os == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }} | |
- name: install dependencies (ubuntu only) | |
if: matrix.os == 'ubuntu-latest' # This must match the platform value defined above. | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libwebkit2gtk-4.0-dev libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf | |
# webkitgtk 4.0 is for Tauri v1 - webkitgtk 4.1 is for Tauri v2. | |
# You can remove the one that doesn't apply to your app to speed up the workflow a bit. | |
- name: Install dependencies | |
run: pnpm install | |
- name: Import Apple Developer Certificate | |
if: (matrix.os == 'macos-latest') || (matrix.os == 'macos-13') | |
env: | |
APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }} | |
APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }} | |
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }} | |
APPLE_ID: ${{ secrets.APPLE_ID }} | |
APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }} | |
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} | |
run: | | |
echo $APPLE_CERTIFICATE | base64 --decode > certificate.p12 | |
security create-keychain -p "$KEYCHAIN_PASSWORD" build.keychain | |
security default-keychain -s build.keychain | |
security unlock-keychain -p "$KEYCHAIN_PASSWORD" build.keychain | |
security import certificate.p12 -k build.keychain -P "$APPLE_CERTIFICATE_PASSWORD" -T /usr/bin/codesign | |
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "$KEYCHAIN_PASSWORD" build.keychain | |
security find-identity -v -p codesigning build.keychain | |
- name: Verify Certificate | |
run: | | |
CERT_INFO=$(security find-identity -v -p codesigning build.keychain | grep "Developer ID Application") | |
CERT_ID=$(echo "$CERT_INFO" | awk -F'"' '{print $2}') | |
echo "CERT_ID=$CERT_ID" >> $GITHUB_ENV | |
echo "Certificate imported." | |
- uses: tauri-apps/tauri-action@v0 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }} | |
APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }} | |
APPLE_SIGNING_IDENTITY: ${{ env.CERT_ID }} | |
with: | |
args: ${{ matrix.args }} | |
- uses: tauri-apps/tauri-action@v0 | |
if: (matrix.os == 'windows-latest') || (matrix.os == 'ubuntu-latest') | |
with: | |
tagName: app-v__VERSION__ # the action automatically replaces \_\_VERSION\_\_ with the app version. | |
releaseName: 'App v__VERSION__' | |
releaseBody: 'See the assets to download this version and install.' | |
releaseDraft: false | |
prerelease: false | |
args: ${{ matrix.settings.args }} | |
- name: publish artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: build ${{ matrix.os }} ${{ github.sha }} | |
path: | | |
./src-tauri/target/release/bundle | |
if-no-files-found: error | |
overwrite: true | |