Build Single App #5
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: Build Single App | |
on: | |
workflow_dispatch: | |
inputs: | |
name: | |
description: "app name" | |
required: true | |
default: "twitter" | |
title: | |
description: "app title" | |
required: true | |
default: "Twitter" | |
cnName: | |
description: "app name in Chinese" | |
required: true | |
default: "推特" | |
url: | |
description: "app url" | |
required: true | |
default: "https://twitter.com/" | |
workflow_call: | |
# push: | |
# # Sequence of patterns matched against refs/tags | |
# tags: | |
# - "V*" | |
jobs: | |
build_single_app: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
build: [linux,macos] | |
include: | |
- build: linux | |
os: ubuntu-latest | |
rust: stable | |
target: x86_64-unknown-linux-musl | |
- build: windows | |
os: windows-latest | |
rust: stable-x86_64-msvc | |
target: x86_64-pc-windows-msvc | |
- build: macos | |
os: macos-latest | |
rust: stable | |
target: x86_64-apple-darwin | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
# - name: install node | |
# uses: actions/setup-node@v3 | |
# with: | |
# node-version: 18 | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: ${{ matrix.rust }} | |
target: ${{ matrix.target }} | |
- name: rust cache restore | |
uses: actions/cache/restore@v3 | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
src-tauri/target/ | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
- name: Config App | |
env: | |
NAME: ${{ github.event.inputs.name }} | |
TITLE: ${{ github.event.inputs.title }} | |
CN_NAME: ${{ github.event.inputs.cnName }} | |
URL: ${{ github.event.inputs.url }} | |
run: | | |
npm install | |
npm run build:app:config | |
- name: install dependencies (ubuntu only) | |
if: matrix.os == 'ubuntu-latest' | |
uses: awalsh128/cache-apt-pkgs-action@latest | |
with: | |
packages: libwebkit2gtk-4.0-dev build-essential curl wget libssl-dev libgtk-3-dev libayatana-appindicator3-dev librsvg2-dev gnome-video-effects gnome-video-effects-extra | |
version: 1.1 | |
- name: Build for Ubuntu | |
if: matrix.os == 'ubuntu-latest' | |
run: npm run tauri build | |
- name: Build for Macos | |
if: matrix.os == 'macos-latest' | |
run: | | |
rustup target add aarch64-apple-darwin | |
rustup target add x86_64-apple-darwin | |
npm run tauri build --target universal-apple-darwin | |
# - name: Build for Windows | |
# if: matrix.os == 'windows-latest' | |
# run: npm run tauri build --target x86_64-pc-windows-msvc | |
# - name: Upload files | |
# # arg info: https://github.com/ncipollo/release-action#release-action | |
# uses: ncipollo/release-action@v1 | |
# with: | |
# allowUpdates: true | |
# artifacts: "output/*/*.*" | |
# token: ${{ secrets.GITHUB_TOKEN }} |