feat(ci): support nightly build (#256)

This commit is contained in:
Neko
2025-07-05 17:20:22 +08:00
committed by GitHub
parent 87c799c4ff
commit fd314058b6
8 changed files with 182 additions and 158 deletions
-90
View File
@@ -1,90 +0,0 @@
name: Build Tamagotchi
permissions:
contents: write
on:
workflow_dispatch:
inputs:
tag:
description: Attach to a specific tag/commit for the release
required: true
type: string
jobs:
build-tamagotchi:
name: Build Tamagotchi
strategy:
matrix:
include:
- os: macos-latest
target: x86_64-apple-darwin
- os: macos-latest
target: aarch64-apple-darwin
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
- os: ubuntu-24.04-arm
target: aarch64-unknown-linux-gnu
- os: windows-latest
target: x86_64-pc-windows-msvc
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
run_install: false
- name: Install Node.js 24.x
uses: actions/setup-node@v4
with:
cache: pnpm
node-version: 24.x
# registry-url required. Learn more at
# https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
registry-url: https://registry.npmjs.org
- name: Get Product Name (Windows Only)
if: matrix.os == 'windows-latest'
run: |
$productName = node -p 'require("./apps/stage-tamagotchi/src-tauri/tauri.conf.json").productName'
echo "PRODUCT_NAME=$productName" >> $env:GITHUB_ENV
- name: Get Product Name
if: matrix.os != 'windows-latest'
run: |
echo "PRODUCT_NAME=$(node -p 'require("./apps/stage-tamagotchi/src-tauri/tauri.conf.json").productName')" >> $GITHUB_ENV
- name: Install Rust Stable
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Install system dependencies (Ubuntu Only)
if: matrix.os == 'ubuntu-latest' || matrix.os == 'ubuntu-24.04-arm'
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build Dependencies
run: pnpm run build:packages
- name: Build Application
run: cd apps/stage-tamagotchi && pnpm tauri build --target ${{ matrix.target }}
- name: Debug Environment
run: |
echo "PRODUCT_NAME: '${{ env.PRODUCT_NAME }}'"
- name: Rename Artifacts
run: node apps/stage-tamagotchi/scripts/rename-artifacts.js ${{ matrix.target }}
- name: Upload To GitHub Releases
uses: softprops/action-gh-release@v2
with:
files: bundle/${{ env.PRODUCT_NAME }}_*
append_body: true
tag_name: ${{ github.event.inputs.tag }}
+36 -3
View File
@@ -7,6 +7,14 @@ on:
release:
types:
- prereleased
workflow_dispatch:
inputs:
tag:
description: Attach to a specific tag/commit for the release (leave empty to auto-detect latest tag)
required: false
type: string
schedule:
- cron: '0 0 * * *'
jobs:
build-tamagotchi:
@@ -73,10 +81,35 @@ jobs:
- name: Build Application
run: cd apps/stage-tamagotchi && pnpm tauri build --target ${{ matrix.target }}
- name: Rename Artifacts
run: node apps/stage-tamagotchi/scripts/rename-artifacts.js ${{ matrix.target }}
- name: Rename Artifacts (Nightly)
if: ${{ github.event_name == 'schedule' }}
run: pnpm run -F @proj-airi/stage-tamagotchi rename-artifacts ${{ matrix.target }}
- name: Upload To GitHub Releases
- name: Rename Artifacts (Manual)
if: ${{ github.event_name == 'workflow_dispatch' }}
run: pnpm run -F @proj-airi/stage-tamagotchi rename-artifacts ${{ matrix.target }} --release --tag ${{ github.event.inputs.tag }} --auto-tag
- name: Rename Artifacts (Automatic)
if: ${{ github.event_name == 'release' }}
run: pnpm run -F @proj-airi/stage-tamagotchi rename-artifacts ${{ matrix.target }} --release
- name: Upload Artifacts
if: ${{ github.event_name == 'schedule' }}
uses: actions/upload-artifact@v4
with:
name: Artifacts
path: bundle/${{ env.PRODUCT_NAME }}_*
- name: Upload To GitHub Releases (Manual)
if: ${{ github.event_name == 'workflow_dispatch' }}
uses: softprops/action-gh-release@v2
with:
files: bundle/${{ env.PRODUCT_NAME }}_*
append_body: true
tag_name: ${{ github.event.inputs.tag }}
- name: Upload To GitHub Releases (Automatic)
if: ${{ github.event_name == 'release' }}
uses: softprops/action-gh-release@v2
with:
files: bundle/${{ env.PRODUCT_NAME }}_*