-
Notifications
You must be signed in to change notification settings - Fork 3
147 lines (141 loc) · 4.43 KB
/
build.yml
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
name: Build APP
on:
workflow_dispatch:
jobs:
build-for-macos:
name: macOS
permissions:
contents: write
strategy:
fail-fast: false
matrix:
include:
- target: universal-apple-darwin
build: macos
os: macos-latest
arch: universal
- target: aarch64-apple-darwin
build: macos
os: macos-latest
arch: aarch64
- target: x86_64-apple-darwin
build: macos
os: macos-latest
arch: x86_64
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Setup Yarn
uses: actions/setup-node@v4
with:
node-version: 20
cache: "yarn"
cache-dependency-path: "yarn.lock"
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
targets: ${{ matrix.arch == 'universal' && 'aarch64-apple-darwin,x86_64-apple-darwin' || matrix.target }}
- name: Setup Rust Cache
uses: swatinem/rust-cache@v2
with:
workspaces: './src-tauri -> target'
- name: Build APP
run: |
yarn install
VERSION=$(node -p "require('./package.json').version")
CI=false yarn tauri build -c "{\"version\":\"$VERSION\"}" -t ${{ matrix.target }}
APP_NAME="Imagenie_${VERSION}_${{ matrix.build }}_${{ matrix.arch }}"
node scripts/dist.js ${{ matrix.target }} $APP_NAME
- name: Upload App
uses: actions/upload-artifact@v4
with:
name: app_${{ matrix.build }}_${{ matrix.arch }}
path: dist/Imagenie_*
build-for-windows:
name: Windows
permissions:
contents: write
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-pc-windows-msvc
build: windows
os: windows-latest
arch: x86_64
- target: aarch64-pc-windows-msvc
build: windows
os: windows-latest
arch: aarch64
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Setup Yarn
uses: actions/setup-node@v4
with:
node-version: 20
cache: "yarn"
cache-dependency-path: "yarn.lock"
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
targets: ${{ matrix.target }}
- name: Setup Rust Cache
uses: swatinem/rust-cache@v2
with:
workspaces: './src-tauri -> target'
- name: Build APP
shell: pwsh
run: |
yarn install
$VERSION = node -p "require('./package.json').version"
$env:TAURI_BUNDLE_NSI = "true"
$CONFIG = @{version=$VERSION} | ConvertTo-Json -Compress
yarn tauri build --config $CONFIG -t ${{ matrix.target }} --bundles nsis
if ($LASTEXITCODE -ne 0) {
throw "Tauri build failed with exit code $LASTEXITCODE"
}
$APP_NAME = "Imagenie_${VERSION}_${{ matrix.build }}_${{ matrix.arch }}"
node scripts/dist.js ${{ matrix.target }} $APP_NAME
- name: Upload App
uses: actions/upload-artifact@v4
with:
name: app_${{ matrix.build }}_${{ matrix.arch }}
path: dist/Imagenie_*
release:
name: Release
needs: [build-for-macos, build-for-windows]
runs-on: ubuntu-latest
permissions: write-all
steps:
- uses: actions/checkout@v4
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
pattern: app_*
path: dist
merge-multiple: true
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Check Version
id: version
run: |
VERSION=$(node -p "require('./package.json').version")
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Release Imagenie v${{ steps.version.outputs.version }}
uses: ncipollo/release-action@v1
with:
allowUpdates: true
token: ${{ secrets.GITHUB_TOKEN }}
tag: app-v${{ steps.version.outputs.version }}
name: Imagenie v${{ steps.version.outputs.version }}
body: Imagenie APP v${{ steps.version.outputs.version }}
draft: true
prerelease: false
makeLatest: latest
removeArtifacts: true
artifacts: dist/*