Improve Deployment #115
This file contains hidden or 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
# TODO | |
# - Issues finding the plugin folder on Windows | |
name: Build/release | |
on: | |
push: | |
branches: | |
- main | |
- alpha | |
- beta | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out Git repository | |
uses: actions/checkout@v4 | |
- uses: oven-sh/setup-bun@v2 | |
- name: Install Dependencies | |
run: bun install | |
- name: Release | |
run: bunx semantic-release | |
- name: Archive production artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: build | |
path: build | |
release: | |
needs: build | |
permissions: | |
contents: write | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- platform: 'macos-latest' # for Arm based macs (M1 and above). | |
args: '--target aarch64-apple-darwin' | |
arch: 'aarch64-apple-darwin' | |
- platform: 'macos-latest' # for Intel based macs. | |
args: '--target x86_64-apple-darwin' | |
arch: 'x86_64-apple-darwin' | |
- platform: 'ubuntu-24.04' # for Tauri v1 you could replace this with ubuntu-20.04. | |
args: '' | |
arch: 'x86_64-unknown-linux-gnu' | |
- platform: 'windows-latest' | |
args: '' | |
arch: 'x86_64-pc-windows-msvc' | |
runs-on: ${{ matrix.platform }} | |
steps: | |
- name: Check out Git repository | |
uses: actions/checkout@v4 | |
with: | |
ref: alpha | |
path: app | |
- name: install dependencies (ubuntu only) | |
if: matrix.platform == 'ubuntu-24.04' # This must match the platform value defined above. | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf | |
- 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.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }} | |
- uses: oven-sh/setup-bun@v2 | |
- name: Install Dependencies | |
working-directory: ./app | |
run: bun install | |
- name: Download production artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: build | |
path: app/build | |
- name: Build Bun Server | |
working-directory: ./app | |
run: bun run build:server | |
env: | |
BUILD_ARCH: ${{ matrix.arch }} | |
- name: Prepare for app notarization | |
if: startsWith(matrix.platform, 'macos') | |
# Import Apple API key for app notarization on macOS | |
run: | | |
mkdir -p ~/private_keys/ | |
echo '${{ secrets.api_key }}' > ~/private_keys/AuthKey_${{ secrets.api_key_id }}.p8 | |
- name: Checkout Kiosk | |
uses: actions/checkout@v4 | |
with: | |
repository: thorium-sim/thorium-nova-kiosk | |
path: kiosk | |
# Files that are passed from app to kiosk | |
# - Icons | |
# - Built bun server | |
# - tauri.conf.json | |
# - Entitlements.plist | |
# - web folder | |
- name: Copy files | |
run: | | |
cp -rf ./app/desktop/. ./kiosk/src-tauri | |
- name: Rust cache | |
uses: swatinem/rust-cache@v2 | |
with: | |
workspaces: './kiosk/src-tauri -> target' | |
- name: Fix Tauri Version | |
id: get-version | |
run: | | |
bun .github/actions/fixVersion.ts | |
- name: Sign Bun Server | |
if: startsWith(matrix.platform, 'macos') | |
working-directory: ./app | |
run: bun run sign | |
env: | |
BUILD_ARCH: ${{ matrix.arch }} | |
# Signing | |
APPLE_CERTIFICATE: ${{ secrets.MAC_CERTS }} | |
APPLE_CERTIFICATE_PASSWORD: ${{ secrets.MAC_CERTS_PASSWORD }} | |
APPLE_SIGNING_IDENTITY: ${{ env.CERT_ID }} | |
# Notarization | |
APPLE_ID: ${{ secrets.APPLE_ID }} | |
APPLE_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }} | |
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} | |
- name: Release | |
id: make-release | |
uses: softprops/action-gh-release@v2 | |
with: | |
tag_name: ${{ steps.get-version.outputs.version }} | |
make_latest: true | |
body: "See CHANGELOG.md for release notes. Download the asset for your platform. `thoriumNovaServer-` assets run the server without running a kiosk. Be sure to run `chmod +x thoriumNovaServer-ARCH` to make them executable." | |
files: | | |
app/binaries/* | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Copy server | |
run: | | |
cp -rf ./app/binaries/. ./kiosk/src-tauri/binaries | |
- uses: tauri-apps/tauri-action@v0 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# Signing | |
APPLE_CERTIFICATE: ${{ secrets.MAC_CERTS }} | |
APPLE_CERTIFICATE_PASSWORD: ${{ secrets.MAC_CERTS_PASSWORD }} | |
APPLE_SIGNING_IDENTITY: ${{ env.CERT_ID }} | |
# Notarization | |
APPLE_ID: ${{ secrets.APPLE_ID }} | |
APPLE_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }} | |
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} | |
with: | |
appVersion: ${{ steps.get-version.outputs.version }} | |
releaseId: ${{ steps.make-release.outputs.id }} | |
args: ${{ matrix.args }} | |
# - name: Setup tmate session | |
# uses: mxschmitt/action-tmate@v2 | |
# if: failure() |