更换构建脚本
This commit is contained in:
167
.github/workflows/build.yml
vendored
167
.github/workflows/build.yml
vendored
@ -1,5 +1,4 @@
|
|||||||
|
name: 'Build'
|
||||||
name: Release
|
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
@ -7,140 +6,58 @@ on:
|
|||||||
- "v*.*.*"
|
- "v*.*.*"
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
|
# This workflow will trigger on each push to the `release` branch to create or update a GitHub release, build your app, and upload the artifacts to the release.
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
release:
|
publish-tauri:
|
||||||
name: Publish to Github Releases
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
outputs:
|
|
||||||
rc: ${{ steps.check-tag.outputs.rc }}
|
|
||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- target: aarch64-unknown-linux-musl
|
- platform: 'macos-latest' # for Arm based macs (M1 and above).
|
||||||
use-cross: true
|
args: '--target aarch64-apple-darwin'
|
||||||
os: ubuntu-latest
|
- platform: 'macos-latest' # for Intel based macs.
|
||||||
cargo-flags: ""
|
args: '--target x86_64-apple-darwin'
|
||||||
- target: aarch64-apple-darwin
|
- platform: 'ubuntu-22.04' # for Tauri v1 you could replace this with ubuntu-20.04.
|
||||||
os: macos-latest
|
args: ''
|
||||||
use-cross: true
|
- platform: 'windows-latest'
|
||||||
cargo-flags: ""
|
args: ''
|
||||||
- target: aarch64-pc-windows-msvc
|
|
||||||
os: windows-latest
|
|
||||||
use-cross: true
|
|
||||||
cargo-flags: ""
|
|
||||||
- target: x86_64-apple-darwin
|
|
||||||
os: macos-latest
|
|
||||||
cargo-flags: ""
|
|
||||||
- target: x86_64-pc-windows-msvc
|
|
||||||
os: windows-latest
|
|
||||||
cargo-flags: ""
|
|
||||||
- target: x86_64-unknown-linux-musl
|
|
||||||
os: ubuntu-latest
|
|
||||||
use-cross: true
|
|
||||||
cargo-flags: ""
|
|
||||||
- target: i686-unknown-linux-musl
|
|
||||||
os: ubuntu-latest
|
|
||||||
use-cross: true
|
|
||||||
cargo-flags: ""
|
|
||||||
- target: i686-pc-windows-msvc
|
|
||||||
os: windows-latest
|
|
||||||
use-cross: true
|
|
||||||
cargo-flags: ""
|
|
||||||
- target: armv7-unknown-linux-musleabihf
|
|
||||||
os: ubuntu-latest
|
|
||||||
use-cross: true
|
|
||||||
cargo-flags: ""
|
|
||||||
- target: arm-unknown-linux-musleabihf
|
|
||||||
os: ubuntu-latest
|
|
||||||
use-cross: true
|
|
||||||
cargo-flags: ""
|
|
||||||
|
|
||||||
runs-on: ${{matrix.os}}
|
|
||||||
env:
|
|
||||||
BUILD_CMD: cargo tauri
|
|
||||||
|
|
||||||
|
runs-on: ${{ matrix.platform }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Check Tag
|
- name: setup node
|
||||||
id: check-tag
|
uses: actions/setup-node@v4
|
||||||
shell: bash
|
with:
|
||||||
run: |
|
node-version: lts/*
|
||||||
ver=${GITHUB_REF##*/}
|
|
||||||
echo "version=$ver" >> $GITHUB_OUTPUT
|
|
||||||
if [[ "$ver" =~ [0-9]+.[0-9]+.[0-9]+$ ]]; then
|
|
||||||
echo "rc=false" >> $GITHUB_OUTPUT
|
|
||||||
else
|
|
||||||
echo "rc=true" >> $GITHUB_OUTPUT
|
|
||||||
fi
|
|
||||||
- name: Install Rust Toolchain Components
|
|
||||||
uses: dtolnay/rust-toolchain@stable
|
|
||||||
with:
|
|
||||||
targets: ${{ matrix.target }}
|
|
||||||
|
|
||||||
|
|
||||||
- name: Install cross
|
- name: install Rust stable
|
||||||
if: matrix.use-cross
|
uses: dtolnay/rust-toolchain@stable
|
||||||
uses: taiki-e/install-action@v2
|
with:
|
||||||
with:
|
# Those targets are only used on macos runners so it's in an `if` to slightly speed up windows and linux builds.
|
||||||
tool: cross
|
targets: ${{ matrix.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }}
|
||||||
|
|
||||||
- name: Overwrite build command env variable
|
- name: install dependencies (ubuntu only)
|
||||||
if: matrix.use-cross
|
if: matrix.platform == 'ubuntu-22.04' # This must match the platform value defined above.
|
||||||
shell: bash
|
run: |
|
||||||
run: echo "BUILD_CMD=cross" >> $GITHUB_ENV
|
sudo apt-get update
|
||||||
|
sudo apt-get install -y libwebkit2gtk-4.0-dev libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf
|
||||||
|
# webkitgtk 4.0 is for Tauri v1 - webkitgtk 4.1 is for Tauri v2.
|
||||||
|
# You can remove the one that doesn't apply to your app to speed up the workflow a bit.
|
||||||
|
|
||||||
- name: 安装Tauri构建工具
|
- name: install frontend dependencies
|
||||||
run: cargo install tauri-cli --version "^2.0.0" --locked
|
run: yarn install # change this to npm, pnpm or bun depending on which one you use.
|
||||||
|
|
||||||
- name: Show Version Information (Rust, cargo, GCC)
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
gcc --version || true
|
|
||||||
rustup -V
|
|
||||||
rustup toolchain list
|
|
||||||
rustup default
|
|
||||||
cargo -V
|
|
||||||
rustc -V
|
|
||||||
|
|
||||||
- name: Build
|
|
||||||
shell: bash
|
|
||||||
run: $BUILD_CMD build --release --target=${{ matrix.target }} ${{ matrix.cargo-flags }}
|
|
||||||
|
|
||||||
- name: Build Archive
|
- uses: tauri-apps/tauri-action@v0
|
||||||
shell: bash
|
env:
|
||||||
id: package
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
env:
|
with:
|
||||||
target: ${{ matrix.target }}
|
tagName: app-v__VERSION__ # the action automatically replaces \_\_VERSION\_\_ with the app version.
|
||||||
version: ${{ steps.check-tag.outputs.version }}
|
releaseName: 'App v__VERSION__'
|
||||||
run: |
|
releaseBody: 'See the assets to download this version and install.'
|
||||||
set -euxo pipefail
|
releaseDraft: true
|
||||||
bin=${GITHUB_REPOSITORY##*/}
|
prerelease: false
|
||||||
dist_dir=`pwd`/dist
|
args: ${{ matrix.args }}
|
||||||
name=$bin-$version-$target
|
|
||||||
executable=target/$target/release/$bin
|
|
||||||
if [[ "$RUNNER_OS" == "Windows" ]]; then
|
|
||||||
executable=$executable.exe
|
|
||||||
fi
|
|
||||||
mkdir $dist_dir
|
|
||||||
cp $executable $dist_dir
|
|
||||||
cd $dist_dir
|
|
||||||
if [[ "$RUNNER_OS" == "Windows" ]]; then
|
|
||||||
archive=$dist_dir/$name.zip
|
|
||||||
7z a $archive *
|
|
||||||
echo "archive=dist/$name.zip" >> $GITHUB_OUTPUT
|
|
||||||
else
|
|
||||||
archive=$dist_dir/$name.tar.gz
|
|
||||||
tar -czf $archive *
|
|
||||||
echo "archive=dist/$name.tar.gz" >> $GITHUB_OUTPUT
|
|
||||||
fi
|
|
||||||
- name: Publish Archive
|
|
||||||
uses: softprops/action-gh-release@v2
|
|
||||||
if: ${{ startsWith(github.ref, 'refs/tags/') }}
|
|
||||||
with:
|
|
||||||
draft: false
|
|
||||||
files: ${{ steps.package.outputs.archive }}
|
|
||||||
prerelease: ${{ steps.check-tag.outputs.rc == 'true' }}
|
|
||||||
146
.github/workflows/build.yml.bak
vendored
Normal file
146
.github/workflows/build.yml.bak
vendored
Normal file
@ -0,0 +1,146 @@
|
|||||||
|
|
||||||
|
name: Release
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- "v*.*.*"
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
release:
|
||||||
|
name: Publish to Github Releases
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
outputs:
|
||||||
|
rc: ${{ steps.check-tag.outputs.rc }}
|
||||||
|
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- target: aarch64-unknown-linux-musl
|
||||||
|
use-cross: true
|
||||||
|
os: ubuntu-latest
|
||||||
|
cargo-flags: ""
|
||||||
|
- target: aarch64-apple-darwin
|
||||||
|
os: macos-latest
|
||||||
|
use-cross: true
|
||||||
|
cargo-flags: ""
|
||||||
|
- target: aarch64-pc-windows-msvc
|
||||||
|
os: windows-latest
|
||||||
|
use-cross: true
|
||||||
|
cargo-flags: ""
|
||||||
|
- target: x86_64-apple-darwin
|
||||||
|
os: macos-latest
|
||||||
|
cargo-flags: ""
|
||||||
|
- target: x86_64-pc-windows-msvc
|
||||||
|
os: windows-latest
|
||||||
|
cargo-flags: ""
|
||||||
|
- target: x86_64-unknown-linux-musl
|
||||||
|
os: ubuntu-latest
|
||||||
|
use-cross: true
|
||||||
|
cargo-flags: ""
|
||||||
|
- target: i686-unknown-linux-musl
|
||||||
|
os: ubuntu-latest
|
||||||
|
use-cross: true
|
||||||
|
cargo-flags: ""
|
||||||
|
- target: i686-pc-windows-msvc
|
||||||
|
os: windows-latest
|
||||||
|
use-cross: true
|
||||||
|
cargo-flags: ""
|
||||||
|
- target: armv7-unknown-linux-musleabihf
|
||||||
|
os: ubuntu-latest
|
||||||
|
use-cross: true
|
||||||
|
cargo-flags: ""
|
||||||
|
- target: arm-unknown-linux-musleabihf
|
||||||
|
os: ubuntu-latest
|
||||||
|
use-cross: true
|
||||||
|
cargo-flags: ""
|
||||||
|
|
||||||
|
runs-on: ${{matrix.os}}
|
||||||
|
env:
|
||||||
|
BUILD_CMD: cargo tauri
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Check Tag
|
||||||
|
id: check-tag
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
ver=${GITHUB_REF##*/}
|
||||||
|
echo "version=$ver" >> $GITHUB_OUTPUT
|
||||||
|
if [[ "$ver" =~ [0-9]+.[0-9]+.[0-9]+$ ]]; then
|
||||||
|
echo "rc=false" >> $GITHUB_OUTPUT
|
||||||
|
else
|
||||||
|
echo "rc=true" >> $GITHUB_OUTPUT
|
||||||
|
fi
|
||||||
|
- name: Install Rust Toolchain Components
|
||||||
|
uses: dtolnay/rust-toolchain@stable
|
||||||
|
with:
|
||||||
|
targets: ${{ matrix.target }}
|
||||||
|
|
||||||
|
|
||||||
|
- name: Install cross
|
||||||
|
if: matrix.use-cross
|
||||||
|
uses: taiki-e/install-action@v2
|
||||||
|
with:
|
||||||
|
tool: cross
|
||||||
|
|
||||||
|
- name: Overwrite build command env variable
|
||||||
|
if: matrix.use-cross
|
||||||
|
shell: bash
|
||||||
|
run: echo "BUILD_CMD=cross" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: 安装Tauri构建工具
|
||||||
|
run: cargo install tauri-cli --version "^2.0.0" --locked
|
||||||
|
|
||||||
|
- name: Show Version Information (Rust, cargo, GCC)
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
gcc --version || true
|
||||||
|
rustup -V
|
||||||
|
rustup toolchain list
|
||||||
|
rustup default
|
||||||
|
cargo -V
|
||||||
|
rustc -V
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
shell: bash
|
||||||
|
run: $BUILD_CMD build --release --target=${{ matrix.target }} ${{ matrix.cargo-flags }}
|
||||||
|
|
||||||
|
- name: Build Archive
|
||||||
|
shell: bash
|
||||||
|
id: package
|
||||||
|
env:
|
||||||
|
target: ${{ matrix.target }}
|
||||||
|
version: ${{ steps.check-tag.outputs.version }}
|
||||||
|
run: |
|
||||||
|
set -euxo pipefail
|
||||||
|
bin=${GITHUB_REPOSITORY##*/}
|
||||||
|
dist_dir=`pwd`/dist
|
||||||
|
name=$bin-$version-$target
|
||||||
|
executable=target/$target/release/$bin
|
||||||
|
if [[ "$RUNNER_OS" == "Windows" ]]; then
|
||||||
|
executable=$executable.exe
|
||||||
|
fi
|
||||||
|
mkdir $dist_dir
|
||||||
|
cp $executable $dist_dir
|
||||||
|
cd $dist_dir
|
||||||
|
if [[ "$RUNNER_OS" == "Windows" ]]; then
|
||||||
|
archive=$dist_dir/$name.zip
|
||||||
|
7z a $archive *
|
||||||
|
echo "archive=dist/$name.zip" >> $GITHUB_OUTPUT
|
||||||
|
else
|
||||||
|
archive=$dist_dir/$name.tar.gz
|
||||||
|
tar -czf $archive *
|
||||||
|
echo "archive=dist/$name.tar.gz" >> $GITHUB_OUTPUT
|
||||||
|
fi
|
||||||
|
- name: Publish Archive
|
||||||
|
uses: softprops/action-gh-release@v2
|
||||||
|
if: ${{ startsWith(github.ref, 'refs/tags/') }}
|
||||||
|
with:
|
||||||
|
draft: false
|
||||||
|
files: ${{ steps.package.outputs.archive }}
|
||||||
|
prerelease: ${{ steps.check-tag.outputs.rc == 'true' }}
|
||||||
Reference in New Issue
Block a user