319 lines
15 KiB
YAML
319 lines
15 KiB
YAML
name: Release Tamagotchi
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
env:
|
|
BUNDLE_NAME: ''
|
|
DEB_BUNDLE_NAME: ''
|
|
RPM_BUNDLE_NAME: ''
|
|
FLATPAK_BUNDLE_NAME: ''
|
|
PRODUCT_NAME: 'AIRI'
|
|
VERSION: ''
|
|
|
|
on:
|
|
release:
|
|
types:
|
|
- prereleased
|
|
workflow_dispatch:
|
|
inputs:
|
|
build_only:
|
|
description: Build only
|
|
required: false
|
|
default: false
|
|
type: boolean
|
|
artifacts_only:
|
|
description: Build and upload artifacts only
|
|
required: false
|
|
default: false
|
|
type: boolean
|
|
tag:
|
|
description: Specific tag/commit for the release (leave empty to auto-detect latest tag)
|
|
required: false
|
|
type: string
|
|
schedule:
|
|
- cron: '0 0 * * *'
|
|
|
|
jobs:
|
|
build:
|
|
name: Build
|
|
strategy:
|
|
matrix:
|
|
include:
|
|
|
|
- os: macos-15-intel
|
|
artifact: darwin-x64
|
|
target: x86_64-apple-darwin
|
|
arch: x64
|
|
builder-args: --macos --x64
|
|
|
|
- os: macos-latest
|
|
artifact: darwin-arm64
|
|
target: aarch64-apple-darwin
|
|
builder-args: --macos --arm64
|
|
arch: arm64
|
|
|
|
- os: ubuntu-latest
|
|
artifact: linux-x64
|
|
target: x86_64-unknown-linux-gnu
|
|
builder-args: --linux --x64
|
|
arch: x64
|
|
|
|
- os: ubuntu-24.04-arm
|
|
artifact: linux-arm64
|
|
target: aarch64-unknown-linux-gnu
|
|
builder-args: --linux --arm64
|
|
arch: arm64
|
|
|
|
- os: windows-latest
|
|
artifact: windows-x64-setup
|
|
target: x86_64-pc-windows-msvc
|
|
builder-args: --windows --x64
|
|
arch: x64
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
steps:
|
|
# Why?
|
|
#
|
|
# failed to build archive at `/home/runner/work/airi/airi/target/x86_64-unknown-linux-gnu/release/deps/libapp_lib.rlib`:
|
|
# No space left on device (os error 28)
|
|
- name: Free Disk Space
|
|
if: matrix.os == 'ubuntu-latest' || matrix.os == 'ubuntu-24.04-arm'
|
|
uses: jlumbroso/free-disk-space@main
|
|
|
|
- uses: actions/checkout@v5
|
|
|
|
# https://docs.github.com/en/actions/how-tos/deploy/deploy-to-third-party-platforms/sign-xcode-applications
|
|
# - name: Install the Apple certificate (macOS Only)
|
|
# if: matrix.os == 'macos-15-intel' || matrix.os == 'macos-latest'
|
|
# env:
|
|
# BUILD_CERTIFICATE_BASE64: ${{ secrets.BUILD_CERTIFICATE_BASE64 }}
|
|
# P12_PASSWORD: ${{ secrets.P12_PASSWORD }}
|
|
# KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
|
|
# run: |
|
|
# # create variables
|
|
# CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12
|
|
# KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
|
|
|
|
# # import certificate from secrets
|
|
# echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode -o $CERTIFICATE_PATH
|
|
|
|
# # create temporary keychain
|
|
# security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
|
|
# security set-keychain-settings -lut 21600 $KEYCHAIN_PATH
|
|
# security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
|
|
|
|
# # import certificate to keychain
|
|
# security import $CERTIFICATE_PATH -P "$P12_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
|
|
# security set-key-partition-list -S apple-tool:,apple: -k "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
|
|
# security list-keychain -d user -s $KEYCHAIN_PATH
|
|
|
|
- uses: pnpm/action-setup@v4
|
|
with:
|
|
run_install: false
|
|
- uses: actions/setup-node@v5
|
|
with:
|
|
node-version: lts/*
|
|
cache: pnpm
|
|
- run: pnpm install --frozen-lockfile
|
|
|
|
# ---------
|
|
# Build
|
|
# ---------
|
|
|
|
- run: pnpm run build:packages
|
|
|
|
- name: Build (Windows Only) # Windows
|
|
if: matrix.os == 'windows-latest'
|
|
run: pnpm run -F @proj-airi/stage-tamagotchi build && pnpm -F @proj-airi/stage-tamagotchi exec electron-builder build ${{ matrix.builder-args }}
|
|
|
|
- name: Build (macOS Only) # macOS
|
|
if: matrix.os == 'macos-15-intel' || matrix.os == 'macos-latest'
|
|
run: pnpm run -F @proj-airi/stage-tamagotchi build && pnpm -F @proj-airi/stage-tamagotchi exec electron-builder build ${{ matrix.builder-args }}
|
|
|
|
- name: Build (Linux Only) # Linux
|
|
if: matrix.os == 'ubuntu-latest' || matrix.os == 'ubuntu-24.04-arm'
|
|
run: pnpm run -F @proj-airi/stage-tamagotchi build && pnpm -F @proj-airi/stage-tamagotchi exec electron-builder build ${{ matrix.builder-args }}
|
|
|
|
- name: Setup Flatpak (Linux Only)
|
|
if: ${{ matrix.os == 'ubuntu-latest' || matrix.os == 'ubuntu-24.04-arm' }}
|
|
run: |
|
|
sudo apt update
|
|
sudo apt install -y flatpak flatpak-builder elfutils
|
|
flatpak --version
|
|
flatpak --user remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
|
|
|
|
- name: Build Flatpak (Linux Only) # Flatpak
|
|
if: ${{ matrix.os == 'ubuntu-latest' || matrix.os == 'ubuntu-24.04-arm' }}
|
|
working-directory: ./apps/stage-tamagotchi
|
|
run: |
|
|
mkdir -p dist
|
|
# Auto-install required SDK/Platform/BaseApp from Flathub in user scope
|
|
flatpak-builder --user --install-deps-from=flathub ./flatpak ai.moeru.airi.flatpak.yml --force-clean
|
|
flatpak build-export ./flatpak-repo ./flatpak
|
|
export FLATPAK_OUTPUT_NAME=$(pnpm exec tsx scripts/artifacts-metadata.ts ${{ matrix.target }} --get-output-filename flatpak)
|
|
flatpak build-bundle ./flatpak-repo dist/${FLATPAK_OUTPUT_NAME} ai.moeru.airi
|
|
|
|
# ---------
|
|
# Nightly (schedule) builds only
|
|
# ---------
|
|
|
|
- name: Get Artifacts Envs (Nightly + Windows Only)
|
|
if: ${{ github.event_name == 'schedule' && matrix.os == 'windows-latest' }}
|
|
working-directory: ./apps/stage-tamagotchi
|
|
run: |
|
|
echo "BUNDLE_NAME=$(pnpm exec tsx scripts/artifacts-metadata.ts ${{ matrix.target }} --get-bundle-name)" >> $env:GITHUB_ENV
|
|
echo "VERSION=$(pnpm exec tsx scripts/artifacts-metadata.ts ${{ matrix.target }} --get-version)" >> $env:GITHUB_ENV
|
|
|
|
- name: Get Artifacts Envs (Nightly + Non-Windows)
|
|
if: ${{ github.event_name == 'schedule' && matrix.os != 'windows-latest' }}
|
|
working-directory: ./apps/stage-tamagotchi
|
|
run: |
|
|
echo "VERSION=$(pnpm exec tsx scripts/artifacts-metadata.ts ${{ matrix.target }} --get-version)" >> $GITHUB_ENV
|
|
|
|
- name: Get Artifacts Envs (Nightly + macOS Only)
|
|
if: ${{ github.event_name == 'schedule' && (matrix.os == 'macos-latest' || matrix.os == 'macos-15-intel') }}
|
|
working-directory: ./apps/stage-tamagotchi
|
|
run: |
|
|
echo "BUNDLE_NAME=$(pnpm exec tsx scripts/artifacts-metadata.ts ${{ matrix.target }} --get-bundle-name)" >> $GITHUB_ENV
|
|
|
|
- name: Rename Artifacts (Nightly)
|
|
if: ${{ github.event_name == 'schedule' }}
|
|
run:
|
|
pnpm run -F @proj-airi/stage-tamagotchi rename-artifacts ${{ matrix.target }}
|
|
|
|
- name: Get Linux Artifact Names (Nightly + Linux Only)
|
|
if: ${{ github.event_name == 'schedule' && (matrix.os == 'ubuntu-latest' || matrix.os == 'ubuntu-24.04-arm') }}
|
|
working-directory: ./apps/stage-tamagotchi
|
|
run: |
|
|
echo "DEB_BUNDLE_NAME=$(pnpm exec tsx scripts/artifacts-metadata.ts ${{ matrix.target }} --get-filename deb)" >> $GITHUB_ENV
|
|
echo "RPM_BUNDLE_NAME=$(pnpm exec tsx scripts/artifacts-metadata.ts ${{ matrix.target }} --get-filename rpm)" >> $GITHUB_ENV
|
|
echo "FLATPAK_BUNDLE_NAME=$(pnpm exec tsx scripts/artifacts-metadata.ts ${{ matrix.target }} --get-filename flatpak)" >> $GITHUB_ENV
|
|
|
|
- name: Upload Artifacts (Nightly + Non-Linux)
|
|
if: ${{ github.event_name == 'schedule' && (matrix.os != 'ubuntu-latest' && matrix.os != 'ubuntu-24.04-arm') }}
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: ${{ env.BUNDLE_NAME }}
|
|
path: apps/stage-tamagotchi/bundle/${{ env.BUNDLE_NAME }}
|
|
|
|
- name: Upload Artifacts (Nightly + Linux deb)
|
|
if: ${{ github.event_name == 'schedule' && (matrix.os == 'ubuntu-latest' || matrix.os == 'ubuntu-24.04-arm') }}
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: ${{ env.DEB_BUNDLE_NAME }}
|
|
path: apps/stage-tamagotchi/bundle/${{ env.DEB_BUNDLE_NAME }}
|
|
|
|
- name: Upload Artifacts (Nightly + Linux rpm)
|
|
if: ${{ github.event_name == 'schedule' && (matrix.os == 'ubuntu-latest' || matrix.os == 'ubuntu-24.04-arm') }}
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: ${{ env.RPM_BUNDLE_NAME }}
|
|
path: apps/stage-tamagotchi/bundle/${{ env.RPM_BUNDLE_NAME }}
|
|
|
|
- name: Upload Flatpak Artifact (Nightly + Linux Only)
|
|
if: ${{ github.event_name == 'schedule' && (matrix.os == 'ubuntu-latest' || matrix.os == 'ubuntu-24.04-arm') }}
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: ${{ env.FLATPAK_BUNDLE_NAME }}
|
|
path: apps/stage-tamagotchi/bundle/${{ env.FLATPAK_BUNDLE_NAME }}
|
|
|
|
# ---------
|
|
# Workflow Dispatch only
|
|
# ---------
|
|
|
|
- name: Get Artifacts Envs (Manual + Windows Only)
|
|
if: ${{ github.event_name == 'workflow_dispatch' && matrix.os == 'windows-latest' }}
|
|
working-directory: ./apps/stage-tamagotchi
|
|
run: |
|
|
echo "BUNDLE_NAME=$(pnpm exec tsx scripts/artifacts-metadata.ts ${{ matrix.target }} --get-bundle-name --release ${{ !inputs.build_only && !inputs.artifacts_only }} --tag ${{ inputs.tag }} --auto-tag ${{ !inputs.build_only }})" >> $env:GITHUB_ENV
|
|
echo "VERSION=$(pnpm exec tsx scripts/artifacts-metadata.ts ${{ matrix.target }} --get-version --release ${{ !inputs.build_only && !inputs.artifacts_only }} --tag ${{ inputs.tag }} --auto-tag ${{ !inputs.build_only }})" >> $env:GITHUB_ENV
|
|
|
|
- name: Get Artifacts Envs (Manual + Non-Windows)
|
|
if: ${{ github.event_name == 'workflow_dispatch' && matrix.os != 'windows-latest' }}
|
|
working-directory: ./apps/stage-tamagotchi
|
|
run: |
|
|
echo "VERSION=$(pnpm exec tsx scripts/artifacts-metadata.ts ${{ matrix.target }} --get-version --release ${{ !inputs.build_only && !inputs.artifacts_only }} --tag ${{ inputs.tag }} --auto-tag ${{ !inputs.build_only }})" > $GITHUB_ENV
|
|
|
|
- name: Get Artifacts Envs (Manual + macOS Only)
|
|
if: ${{ github.event_name == 'workflow_dispatch' && (matrix.os == 'macos-latest' || matrix.os == 'macos-15-intel') }}
|
|
working-directory: ./apps/stage-tamagotchi
|
|
run: |
|
|
echo "BUNDLE_NAME=$(pnpm exec tsx scripts/artifacts-metadata.ts ${{ matrix.target }} --get-bundle-name --release ${{ !inputs.build_only && !inputs.artifacts_only }} --tag ${{ inputs.tag }} --auto-tag ${{ !inputs.build_only }})" > $GITHUB_ENV
|
|
|
|
- name: Rename Artifacts (Manual)
|
|
if: ${{ github.event_name == 'workflow_dispatch' }}
|
|
run: |
|
|
pnpm run -F @proj-airi/stage-tamagotchi rename-artifacts ${{ matrix.target }} --release ${{ !inputs.build_only && !inputs.artifacts_only }} --tag ${{ inputs.tag }} --auto-tag ${{ !inputs.build_only }}
|
|
|
|
- name: Get Linux Artifact Names (Manual + Non-Release + Linux Only)
|
|
if: ${{ github.event_name == 'workflow_dispatch' && !inputs.build_only && inputs.artifacts_only && (matrix.os == 'ubuntu-latest' || matrix.os == 'ubuntu-24.04-arm') }}
|
|
working-directory: ./apps/stage-tamagotchi
|
|
run: |
|
|
echo "DEB_BUNDLE_NAME=$(pnpm exec tsx scripts/artifacts-metadata.ts ${{ matrix.target }} --get-filename deb --release ${{ !inputs.build_only && !inputs.artifacts_only }} --tag ${{ inputs.tag }} --auto-tag ${{ !inputs.build_only }})" >> $GITHUB_ENV
|
|
echo "RPM_BUNDLE_NAME=$(pnpm exec tsx scripts/artifacts-metadata.ts ${{ matrix.target }} --get-filename rpm --release ${{ !inputs.build_only && !inputs.artifacts_only }} --tag ${{ inputs.tag }} --auto-tag ${{ !inputs.build_only }})" >> $GITHUB_ENV
|
|
echo "FLATPAK_BUNDLE_NAME=$(pnpm exec tsx scripts/artifacts-metadata.ts ${{ matrix.target }} --get-filename flatpak --release ${{ !inputs.build_only && !inputs.artifacts_only }} --tag ${{ inputs.tag }} --auto-tag ${{ !inputs.build_only }})" >> $GITHUB_ENV
|
|
|
|
- name: Upload Artifacts (Manual + Non-Release + Non-Linux)
|
|
if: ${{ github.event_name == 'workflow_dispatch' && !inputs.build_only && inputs.artifacts_only && (matrix.os != 'ubuntu-latest' && matrix.os != 'ubuntu-24.04-arm') }}
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: ${{ env.BUNDLE_NAME }}
|
|
path: apps/stage-tamagotchi/bundle/${{ env.BUNDLE_NAME }}
|
|
|
|
- name: Upload Artifacts (Manual + Non-Release + Linux deb)
|
|
if: ${{ github.event_name == 'workflow_dispatch' && !inputs.build_only && inputs.artifacts_only && (matrix.os == 'ubuntu-latest' || matrix.os == 'ubuntu-24.04-arm') }}
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: ${{ env.DEB_BUNDLE_NAME }}
|
|
path: apps/stage-tamagotchi/bundle/${{ env.DEB_BUNDLE_NAME }}
|
|
|
|
- name: Upload Artifacts (Manual + Non-Release + Linux rpm)
|
|
if: ${{ github.event_name == 'workflow_dispatch' && !inputs.build_only && inputs.artifacts_only && (matrix.os == 'ubuntu-latest' || matrix.os == 'ubuntu-24.04-arm') }}
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: ${{ env.RPM_BUNDLE_NAME }}
|
|
path: apps/stage-tamagotchi/bundle/${{ env.RPM_BUNDLE_NAME }}
|
|
|
|
- name: Upload Flatpak Artifact (Manual + Non-Release + Linux)
|
|
if: ${{ github.event_name == 'workflow_dispatch' && !inputs.build_only && inputs.artifacts_only && (matrix.os == 'ubuntu-latest' || matrix.os == 'ubuntu-24.04-arm') }}
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: ${{ env.FLATPAK_BUNDLE_NAME }}
|
|
path: apps/stage-tamagotchi/bundle/${{ env.FLATPAK_BUNDLE_NAME }}
|
|
|
|
- name: Upload To GitHub Releases (Manual + Overwrite Release)
|
|
if: ${{ github.event_name == 'workflow_dispatch' && !inputs.build_only && !inputs.artifacts_only }}
|
|
uses: softprops/action-gh-release@v2
|
|
with:
|
|
files: apps/stage-tamagotchi/bundle/${{ env.PRODUCT_NAME }}_*
|
|
append_body: true
|
|
tag_name: ${{ inputs.tag }}
|
|
|
|
# ---------
|
|
# Version push
|
|
# ---------
|
|
|
|
- name: Rename Artifacts (Automatic)
|
|
if: ${{ github.event_name == 'release' }}
|
|
run: |
|
|
pnpm run -F @proj-airi/stage-tamagotchi rename-artifacts ${{ matrix.target }} --release --auto-tag
|
|
|
|
- name: Upload To GitHub Releases (Automatic)
|
|
if: ${{ github.event_name == 'release' }}
|
|
uses: softprops/action-gh-release@v2
|
|
with:
|
|
files: |
|
|
apps/stage-tamagotchi/bundle/${{ env.PRODUCT_NAME }}-*.exe
|
|
apps/stage-tamagotchi/bundle/${{ env.PRODUCT_NAME }}-*.zip
|
|
apps/stage-tamagotchi/bundle/${{ env.PRODUCT_NAME }}-*.dmg
|
|
apps/stage-tamagotchi/bundle/${{ env.PRODUCT_NAME }}-*.deb
|
|
apps/stage-tamagotchi/bundle/${{ env.PRODUCT_NAME }}-*.rpm
|
|
apps/stage-tamagotchi/bundle/${{ env.PRODUCT_NAME }}-*.flatpak
|
|
append_body: true
|
|
|
|
# - name: Clean up keychain and provisioning profile (macOS Only)
|
|
# if: ${{ always() && (matrix.os == 'macos-15-intel' || matrix.os == 'macos-latest') }}
|
|
# run: |
|
|
# security delete-keychain $RUNNER_TEMP/app-signing.keychain-db
|