forked from tw93/Pake
-
Notifications
You must be signed in to change notification settings - Fork 0
156 lines (144 loc) · 4.79 KB
/
pake_build_single_app.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
name: Build Single Popular 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: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 }}