Skip to content

Commit

Permalink
test ci
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasfernog-crabnebula committed Dec 3, 2024
1 parent 58340e6 commit 33610c6
Showing 1 changed file with 105 additions and 128 deletions.
233 changes: 105 additions & 128 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,238 +1,215 @@
name: Deploy
name: Tauri v2 Release Process

on:
workflow_dispatch:
push:
branches:
- main

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
CN_APP_SLUG: release-channels-demo
CN_APPLICATION: "cn-testing/release-channels-demo"

jobs:
draft:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v4

- name: create draft release
uses: crabnebula-dev/cloud-release@v0.2.1
uses: crabnebula-dev/cloud-release@v0
with:
command: release draft ${{ env.CN_APP_SLUG }} --framework tauri
command: release draft ${{ env.CN_APPLICATION }} --framework tauri
api-key: ${{ secrets.CN_API_KEY }}

build-desktop:
build_desktop:
needs: draft

strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04, macos-latest, windows-latest]
os:
- ubuntu-22.04
- macos-latest
- windows-latest

runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4

- name: 🧰 Install pnpm
uses: pnpm/action-setup@v4
- name: Install pnpm
uses: pnpm/action-setup@v3
with:
version: 9

- uses: actions/setup-node@v4
with:
node-version: "lts/*"
- name: Install stable toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
cache: true
rustflags: "" # do not set RUSTFLAGS

- name: install Linux dependencies
if: matrix.os == 'ubuntu-22.04'
run: |
sudo apt-get update
sudo apt-get install -y webkit2gtk-4.1
- name: Cache pnpm modules
uses: actions/cache@v4
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-
- name: Rust Cache
uses: Swatinem/rust-cache@v2

- name: Install NPM modules
run: pnpm install

- name: build Tauri app (macOS)
if: matrix.os == 'macos-latest'
- name: build Tauri app for Windows, Linux
if: matrix.os != 'macos-latest'
run: |
rustup target add x86_64-apple-darwin
# setup API key for notarization
echo "${{ secrets.APPLE_API_KEY }}" > $RUNNER_TEMP/AuthKey.p8
export APPLE_API_KEY_PATH="$RUNNER_TEMP/AuthKey.p8"
# build separate apps for Intel and Apple Silicon
pnpm tauri build --target x86_64-apple-darwin -vv
pnpm tauri build --target aarch64-apple-darwin -vv
pnpm install
pnpm tauri build
env:
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_SIGNING_IDENTITY }}
APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE_BASE64 }}
APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
APPLE_API_ISSUER: ${{ secrets.APPLE_API_ISSUER }}
APPLE_API_KEY: ${{ secrets.APPLE_API_KEY_ID }}

- name: build Tauri app (Windows or Linux)
if: matrix.os != 'macos-latest'
run: pnpm tauri build
- name: Install x86_64-apple-darwin for mac and build Tauri binaries
if: matrix.os == 'macos-latest'
run: |
rustup target add x86_64-apple-darwin
pnpm install
pnpm tauri build --target x86_64-apple-darwin
pnpm tauri build --target aarch64-apple-darwin
env:
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}

- name: upload assets
uses: crabnebula-dev/cloud-release@v0.2.1
uses: crabnebula-dev/cloud-release@v0
with:
command: release upload ${{ env.CN_APP_SLUG }} --framework tauri
command: release upload ${{ env.CN_APPLICATION }} --framework tauri
api-key: ${{ secrets.CN_API_KEY }}
path: ./src-tauri

build-android:
needs: draft
permissions:
contents: write
build_android:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: "lts/*"

- name: Install stable toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
cache: true
rustflags: "" # do not set RUSTFLAGS

- name: 🧰 Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9

- name: Cache pnpm modules
uses: actions/cache@v4
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-
- name: Rust Cache
uses: Swatinem/rust-cache@v2

- name: Install NPM modules
run: pnpm install

- name: Set up JDK 17
uses: actions/setup-java@v3
- name: setup JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
java-version: "17"
distribution: "temurin"

- name: Setup Android SDK
- name: setup Android SDK
uses: android-actions/setup-android@v3

- name: Setup Android NDK
- name: setup Android NDK
uses: nttld/setup-ndk@v1
id: setup-ndk
with:
ndk-version: r26d
link-to-sdk: true

- name: Build Android package
- name: install Android targets
run: rustup target add aarch64-linux-android armv7-linux-androideabi i686-linux-android x86_64-linux-android

- name: setup Android signing
working-directory: crates/app/taurify/gen/android
run: |
echo "keyAlias=${{ secrets.ANDROID_KEY_ALIAS }}" > keystore.properties
echo "password=${{ secrets.ANDROID_KEY_PASSWORD }}" >> keystore.properties
base64 -d <<< "${{ secrets.ANDROID_KEY_BASE64 }}" > $RUNNER_TEMP/keystore.jks
echo "storeFile=$RUNNER_TEMP/keystore.jks" >> keystore.properties
- name: Install pnpm
uses: pnpm/action-setup@v3
with:
version: 9

- name: build Tauri app for Android
env:
NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }}
run: |
export NDK_HOME=${{ steps.setup-ndk.outputs.ndk-path }}
pnpm tauri android init
pnpm install
pnpm tauri android build
#- name: Upload assets
# uses: crabnebula-dev/[email protected]
# with:
# command: release upload ${{ env.CN_APP_SLUG }} --framework tauri
# api-key: ${{ secrets.CN_API_KEY }}
- name: upload assets
uses: crabnebula-dev/cloud-release@v0
with:
command: release upload ${{ env.CN_APPLICATION }} --framework tauri
api-key: ${{ secrets.CN_API_KEY }}
path: ./src-tauri

build-ios:
needs: draft
permissions:
contents: write
build_ios:
runs-on: macos-latest

steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: "lts/*"

- name: Install stable toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
cache: true
target: aarch64-apple-ios
rustflags: "" # do not set RUSTFLAGS

- name: 🧰 Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9

- name: Cache pnpm modules
uses: actions/cache@v4
- name: install iOS target
run: rustup target add aarch64-apple-ios

- name: setup xcode
uses: maxim-lobanov/setup-xcode@v1
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-
xcode-version: latest-stable

- name: Rust Cache
uses: Swatinem/rust-cache@v2
- name: setup Apple API key
run: |
APPLE_API_KEY_PATH="$RUNNER_TEMP/AuthKey_${{ secrets.APPLE_API_KEY_ID }}.p8"
echo "${{ secrets.APPLE_API_KEY }}" > $APPLE_API_KEY_PATH
echo "APPLE_API_KEY_PATH=$APPLE_API_KEY_PATH" >> $GITHUB_ENV
echo "API_PRIVATE_KEYS_DIR=$RUNNER_TEMP" >> $GITHUB_ENV
- name: Install NPM modules
run: pnpm install
- name: Install pnpm
uses: pnpm/action-setup@v3
with:
version: 9

- name: Build iOS package
run: |
# ensure we can recreate the iOS project (only if you have commited it)
# currently that's the only way to apply the certificate and mobile provision
# though Tauri will fix that soon
rm -rf src-tauri/gen/apple
pnpm tauri ios init
pnpm tauri ios build --export-method app-store-connect -vv
- name: build Tauri app for iOS
env:
IOS_MOBILE_PROVISION: ${{ secrets.IOS_PROVISIONING_PROFILE_BASE64 }}
IOS_CERTIFICATE: ${{ secrets.IOS_CERTIFICATE_BASE64 }}
IOS_CERTIFICATE_PASSWORD: ${{ secrets.IOS_CERTIFICATE_PASSWORD }}
APPLE_API_KEY: ${{ secrets.APPLE_API_KEY_ID }}
APPLE_API_ISSUER: ${{ secrets.APPLE_API_ISSUER }}
APPLE_DEVELOPMENT_TEAM: <ENTER TEAM HERE>
run: |
pnpm install
pnpm tauri ios build --export-method app-store-connect
#- name: Upload assets
# uses: crabnebula-dev/[email protected]
# with:
# command: release upload ${{ env.CN_APP_SLUG }} --framework tauri
# api-key: ${{ secrets.CN_API_KEY }}
- name: upload assets
uses: crabnebula-dev/cloud-release@v0
with:
command: release upload ${{ env.CN_APPLICATION }} --framework tauri
api-key: ${{ secrets.CN_API_KEY }}
path: ./src-tauri

publish:
needs: [build-desktop, build-android, build-ios]
needs: [build_desktop, build_android, build_ios]

runs-on: ubuntu-latest
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v4

- name: publish release
uses: crabnebula-dev/cloud-release@v0.2.1
uses: crabnebula-dev/cloud-release@v0
with:
command: release publish ${{ env.CN_APP_SLUG }} --framework tauri
api-key: ${{ secrets.CN_API_KEY }}
command: release publish ${{ env.CN_APPLICATION }} --framework tauri
api-key: ${{ secrets.CN_API_KEY }}

0 comments on commit 33610c6

Please sign in to comment.