-
Notifications
You must be signed in to change notification settings - Fork 3
186 lines (164 loc) · 6.31 KB
/
release.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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
name: "Manual Tauri Release"
on:
workflow_dispatch:
inputs:
# tag_name:
# description: "Tag name for the release"
# required: true
release_name:
description: "Release title"
required: true
release_type:
description: "Type of release (draft, private, public)"
required: true
default: "draft"
release_notes:
description: "Release notes"
required: false
jobs:
create_release:
name: Create GitHub Release
runs-on: ubuntu-latest
outputs:
release_upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- name: Create a release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref_name || github.ref }}
release_name: ${{ github.event.inputs.release_name }}
body: ${{ github.event.inputs.release_notes }}
draft: ${{ github.event.inputs.release_type == 'draft' }} # not visible to the public
prerelease: ${{ github.event.inputs.release_type == 'private' }} # visible only to collaborators
build:
name: Build for ${{ matrix.os }} and Upload Artifacts
needs: create_release
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest] # builds for each platform, in seperate vm's, in this order
continue-on-error: true
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all history for proper Git submodule initialization
ref: ${{ github.event.inputs.ref || github.ref }} # checks out code you specify in github UI
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "18"
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.12"
- name: Set up pip for Python
run: |
python --version
pip --version || python -m ensurepip --upgrade
python -m pip install --upgrade pip
- name: Install dependencies
run: |
corepack enable
corepack prepare pnpm@latest --activate
pnpm install-reqs
- name: Install system dependencies for Linux
if: runner.os == 'linux'
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf
- name: Install Rust
uses: dtolnay/rust-toolchain@stable # Set this to dtolnay/rust-toolchain@nightly
with:
# Those targets are only used on macos runners so it's in an `if` to slightly speed up windows and linux builds.
targets: ${{ matrix.os == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }}
- name: Rust cache
uses: swatinem/rust-cache@v2
with:
workspaces: "./src-tauri -> target"
- name: Build icons
run: pnpm build:icons
- name: Build Python sidecar
shell: bash # ensure cross-platform compatibility with Bash syntax
run: |
if [[ "${{ runner.os }}" == "Linux" ]]; then
pnpm build:sidecar-linux
elif [[ "${{ runner.os }}" == "macOS" ]]; then
pnpm build:sidecar-macos
elif [[ "${{ runner.os }}" == "Windows" ]]; then
pnpm build:sidecar-winos
fi
# Not needed since `pnpm tauri build` runs `pnpm next build` under the hood.
# - name: Build Next.js
# run: pnpm next build
- name: Build Tauri app
run: pnpm tauri build
- name: Determine artifact path
id: artifact_path
shell: bash
run: |
if [[ "${{ runner.os }}" == "Windows" ]]; then
echo "artifact_path=src-tauri/target/release/bundle/nsis/" >> $GITHUB_ENV
else
echo "artifact_path=src-tauri/target/release/bundle/" >> $GITHUB_ENV
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: ${{ runner.os }}-artifact
path: ${{ env.artifact_path }}
upload_assets:
name: Upload Assets to Release
needs: build
runs-on: ubuntu-latest
steps:
- name: Download Linux artifact
if: always()
uses: actions/download-artifact@v3
with:
name: ubuntu-latest-artifact
path: ./artifacts/ubuntu
- name: Download macOS artifact
if: always()
uses: actions/download-artifact@v3
with:
name: macos-latest-artifact
path: ./artifacts/macos
- name: Download Windows artifact
if: always()
uses: actions/download-artifact@v3
with:
name: windows-latest-artifact
path: ./artifacts/windows
- name: Upload Linux asset
if: always()
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.release_upload_url }}
asset_path: ./artifacts/ubuntu/tauri-python-sidecar_${{ github.ref_name }}_x86_x64_Linux-setup.AppImage
asset_name: tauri-python-sidecar_${{ github.ref_name }}_x86_x64_Linux-setup.AppImage
asset_content_type: application/octet-stream
- name: Upload macOS asset
if: always()
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.release_upload_url }}
asset_path: ./artifacts/macos/tauri-python-sidecar_${{ github.ref_name }}_x86_x64_macOS-setup.dmg
asset_name: tauri-python-sidecar_${{ github.ref_name }}_x86_x64_macOS-setup.dmg
asset_content_type: application/octet-stream
- name: Upload Windows asset
if: always()
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.release_upload_url }}
asset_path: ./artifacts/windows/tauri-python-sidecar_${{ github.ref_name }}_x86_x64_Windows-setup.zip
asset_name: tauri-python-sidecar_${{ github.ref_name }}_x86_x64_Windows-setup.zip
asset_content_type: application/octet-stream