refractory build script
This commit is contained in:
85
.github/workflows/pake_build.yaml
vendored
85
.github/workflows/pake_build.yaml
vendored
@@ -1,85 +0,0 @@
|
||||
name: Build App
|
||||
on:
|
||||
push:
|
||||
# Sequence of patterns matched against refs/tags
|
||||
tags:
|
||||
- 'V*'
|
||||
|
||||
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
|
||||
- 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
|
||||
fail-fast: false
|
||||
|
||||
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: 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: 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: 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'
|
||||
shell: pwsh
|
||||
run: |
|
||||
npm run build:all-windows
|
||||
|
||||
- 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 }}
|
||||
36
.github/workflows/pake_build_next.yaml
vendored
Normal file
36
.github/workflows/pake_build_next.yaml
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
name: Build App Next
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "V*"
|
||||
|
||||
jobs:
|
||||
|
||||
read_apps_config:
|
||||
name: Read Apps Config
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
apps_name: ${{ steps.read-apps-config.outputs.apps_name }}
|
||||
apps_config: ${{ steps.read-apps-config.outputs.apps_config }}
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
- name: Get Apps Config
|
||||
id: read-apps-config
|
||||
run: |
|
||||
echo "apps_name=$(jq -c '[.apps| .[] | .name]' apps.conf.json)" >> $GITHUB_OUTPUT
|
||||
echo "apps_config=$(jq -c '[.apps | .[]]' apps.conf.json)" >> $GITHUB_OUTPUT
|
||||
|
||||
trigger_build:
|
||||
needs: read_apps_config
|
||||
name: ${{ matrix.title }}
|
||||
strategy:
|
||||
matrix:
|
||||
name: ${{ fromJson(needs.read_apps_config.outputs.apps_name) }}
|
||||
include: ${{ fromJSON(needs.read_apps_config.outputs.apps_config) }}
|
||||
uses: ./.github/workflows/pake_build_single_app.yaml@master
|
||||
with:
|
||||
name: ${{ matrix.name }}
|
||||
title: ${{ matrix.title }}
|
||||
name_zh: ${{ matrix.name_zh }}
|
||||
url: ${{ matrix.url }}
|
||||
160
.github/workflows/pake_build_single_app.yaml
vendored
Normal file
160
.github/workflows/pake_build_single_app.yaml
vendored
Normal file
@@ -0,0 +1,160 @@
|
||||
name: Build Single App
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
name:
|
||||
description: "app name"
|
||||
required: true
|
||||
default: "twitter"
|
||||
title:
|
||||
description: "app title"
|
||||
required: true
|
||||
default: "Twitter"
|
||||
name_zh:
|
||||
description: "app name in Chinese"
|
||||
required: true
|
||||
default: "推特"
|
||||
url:
|
||||
description: "app url"
|
||||
required: true
|
||||
default: "https://twitter.com/"
|
||||
workflow_call:
|
||||
inputs:
|
||||
name:
|
||||
description: "app name"
|
||||
type: string
|
||||
required: true
|
||||
default: "twitter"
|
||||
title:
|
||||
description: "app title"
|
||||
required: true
|
||||
type: string
|
||||
default: "Twitter"
|
||||
name_zh:
|
||||
description: "app name in Chinese"
|
||||
required: true
|
||||
type: string
|
||||
default: "推特"
|
||||
url:
|
||||
description: "app url"
|
||||
required: true
|
||||
type: string
|
||||
default: "https://twitter.com/"
|
||||
|
||||
jobs:
|
||||
build_single_app:
|
||||
name: ${{ inputs.title }} (${{ matrix.os }})
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
build: [linux, macos, windows]
|
||||
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 Rust
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
toolchain: ${{ matrix.rust }}
|
||||
target: ${{ matrix.target }}
|
||||
|
||||
- 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: rust cache restore
|
||||
id: cache_store
|
||||
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: ${{ inputs.name }}
|
||||
TITLE: ${{ inputs.title }}
|
||||
NAME_ZH: ${{ inputs.name_zh }}
|
||||
URL: ${{ inputs.url }}
|
||||
run: |
|
||||
npm install
|
||||
npm run build:app:config
|
||||
|
||||
|
||||
- name: Build for Ubuntu
|
||||
if: matrix.os == 'ubuntu-latest'
|
||||
run: |
|
||||
npm run tauri build
|
||||
mkdir -p output/linux
|
||||
mv src-tauri/target/release/bundle/deb/*.deb output/linux/${{inputs.title}}_`arch`.deb
|
||||
mv src-tauri/target/release/bundle/appimage/*.AppImage output/linux/"${{inputs.title}}"_`arch`.AppImage
|
||||
|
||||
|
||||
- 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
|
||||
mkdir -p output/macos
|
||||
mv src-tauri/target/universal-apple-darwin/release/bundle/dmg/*.dmg output/macos/"${{inputs.title}}".dmg
|
||||
|
||||
|
||||
- name: Build for Windows
|
||||
if: matrix.os == 'windows-latest'
|
||||
run: |
|
||||
npm run tauri build -- --target x86_64-pc-windows-msvc
|
||||
New-Item -Path "output\windows" -ItemType Directory
|
||||
Move-Item -Path "src-tauri\target\x86_64-pc-windows-msvc\release\bundle\msi\*.msi" -Destination "output\windows\${{inputs.title}}_x64.msi"
|
||||
|
||||
- name: Restore Cargo Lock File(Windows Only)
|
||||
if: matrix.os == 'windows-latest'
|
||||
run: |
|
||||
git checkout -- src-tauri/Cargo.lock
|
||||
|
||||
- name: rust cache store
|
||||
uses: actions/cache/save@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: Upload For Single Build
|
||||
uses: actions/upload-artifact@v3
|
||||
if: startsWith(github.ref, 'refs/tags/') != true
|
||||
with:
|
||||
path: "output/*/*.*"
|
||||
|
||||
- name: Upload For Release
|
||||
# arg info: https://github.com/ncipollo/release-action#release-action
|
||||
uses: ncipollo/release-action@v1
|
||||
if: startsWith(github.ref, 'refs/tags/') == true
|
||||
with:
|
||||
allowUpdates: true
|
||||
artifacts: "output/*/*.*"
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
110
.github/workflows/pake_build_with_cache.yaml
vendored
110
.github/workflows/pake_build_with_cache.yaml
vendored
@@ -1,110 +0,0 @@
|
||||
name: Build App with Cache
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
version:
|
||||
description: 'tag version'
|
||||
required: true
|
||||
default: 'V0.0.1'
|
||||
is_pre_release:
|
||||
description: 'pre-release or release, if true, is pre-release'
|
||||
required: true
|
||||
type: boolean
|
||||
default: true
|
||||
|
||||
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@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: 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: actions/cache/restore@v3
|
||||
id: cache_store
|
||||
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'
|
||||
shell: pwsh
|
||||
run: |
|
||||
npm run build:all-windows
|
||||
|
||||
- name: Upload files
|
||||
# arg info: https://github.com/ncipollo/release-action#release-action
|
||||
uses: ncipollo/release-action@v1
|
||||
with:
|
||||
allowUpdates: true
|
||||
prerelease: ${{ inputs.is_pre_release }}
|
||||
artifacts: 'output/*/*.*'
|
||||
tag: ${{ inputs.version }}
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: rust cache store
|
||||
uses: actions/cache/save@v3
|
||||
if: steps.cache_store.outputs.cache-hit != 'true'
|
||||
with:
|
||||
path: |
|
||||
~/.cargo/bin/
|
||||
~/.cargo/registry/index/
|
||||
~/.cargo/registry/cache/
|
||||
~/.cargo/git/db/
|
||||
src-tauri/target/
|
||||
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
|
||||
Reference in New Issue
Block a user