This commit is contained in:
Tw93
2023-01-08 18:13:41 +08:00
3 changed files with 130 additions and 7 deletions

View File

@@ -15,16 +15,19 @@ jobs:
include:
- build: linux
os: ubuntu-20.04
rust: nightly
rust: stable
target: x86_64-unknown-linux-musl
# archive-name: target-linux.tar.gz
- build: windows
os: windows-latest
rust: nightly-x86_64-msvc
rust: stable-x86_64-msvc
target: x86_64-pc-windows-msvc
# archive-name: target-windows.tar.gz
- build: macos
os: macos-latest
rust: nightly
rust: stable
target: x86_64-apple-darwin
# archive-name: target-macos.tar.gz
fail-fast: false
steps:
@@ -43,12 +46,13 @@ jobs:
profile: minimal
override: true
target: ${{ matrix.target }}
- name: install dependencies (ubuntu only)
if: matrix.os == 'ubuntu-20.04'
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev librsvg2-dev patchelf gnome-video-effects gnome-video-effects-extra
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-20.04'

View File

@@ -0,0 +1,111 @@
name: Build App with Cache
on:
push:
# Sequence of patterns matched against refs/tags
branches:
- release
jobs:
build:
name: build
runs-on: ${{ matrix.os }}
strategy:
matrix:
build: [linux, windows, macos]
include:
- build: linux
os: ubuntu-20.04
rust: stable
target: x86_64-unknown-linux-musl
# archive-name: target-linux.tar.gz
- build: windows
os: windows-latest
rust: stable-x86_64-msvc
target: x86_64-pc-windows-msvc
# archive-name: target-windows.tar.gz
- build: macos
os: macos-latest
rust: stable
target: x86_64-apple-darwin
# archive-name: target-macos.tar.gz
fail-fast: false
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: install node
uses: actions/setup-node@v1
with:
node-version: 18
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
profile: minimal
override: true
target: ${{ matrix.target }}
- name: install dependencies (ubuntu only)
if: matrix.os == 'ubuntu-20.04'
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: rust cache restore
uses: ylemkimon/cache-restore@v2
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
src-tauri/target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: build for Ubuntu
if: matrix.os == 'ubuntu-20.04'
run: npm run build:all-unix
- name: build for MacOS
if: matrix.os == 'macos-latest'
run: |
rustup target add aarch64-apple-darwin
npm run build:all-unix
- name: build for windows
if: matrix.os == 'windows-latest'
run: |
npm run build:all-windows
- name: Upload files
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
curl -L https://github.com/probonopd/uploadtool/raw/master/upload.sh --output upload.sh
bash upload.sh output/*/*.*
- name: rust cache store
uses: actions/cache@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: Build archive
# shell: bash
# run: |
# cd src-tauri
# tar -czf "${{ matrix.archive-name }}" target
# - name: Upload archive
# uses: actions/upload-artifact@v1
# with:
# name: ${{ matrix.archive-name }}
# path: src-tauri/${{ matrix.archive-name }}

8
script/build.sh vendored
View File

@@ -103,12 +103,20 @@ do
npm run tauri build
mv src-tauri/target/release/bundle/deb/${package_prefix}-${package_name}*.deb output/linux/${package_title}_amd64.deb
mv src-tauri/target/release/bundle/appimage/${package_prefix}-${package_name}*.AppImage output/linux/${package_title}_amd64.AppImage
echo clear cache
rm src-tauri/target/release
rm -rf src-tauri/target/release/bundle
fi
if [[ "$OSTYPE" =~ ^darwin ]]; then
npm run tauri build -- --target universal-apple-darwin
mv src-tauri/target/universal-apple-darwin/release/bundle/dmg/*.dmg output/macos/${package_title}.dmg
echo clear cache
rm -rf src-tauri/target/universal-apple-darwin
rm src-tauri/target/aarch64-apple-darwin/release
rm src-tauri/target/x86_64-apple-darwin/release
fi
echo "package build success!"