Skip to content

Commit 6f3ebf6

Browse files
committed
add release workflow (wip)
1 parent def30d1 commit 6f3ebf6

File tree

1 file changed

+168
-0
lines changed

1 file changed

+168
-0
lines changed

.github/workflows/release.yml

Lines changed: 168 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,168 @@
1+
name: "Manual Tauri Release"
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
tag_name:
7+
description: "Tag name for the release"
8+
required: true
9+
release_name:
10+
description: "Release title"
11+
required: true
12+
release_type:
13+
description: "Type of release (draft, private, public)"
14+
required: true
15+
default: "draft"
16+
release_notes:
17+
description: "Release notes"
18+
required: false
19+
20+
jobs:
21+
create_release:
22+
name: Create GitHub Release
23+
runs-on: ubuntu-latest
24+
outputs:
25+
release_upload_url: ${{ steps.create_release.outputs.upload_url }}
26+
steps:
27+
- name: Create a release
28+
id: create_release
29+
uses: actions/create-release@v1
30+
env:
31+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32+
with:
33+
tag_name: ${{ github.event.inputs.tag_name }}
34+
release_name: ${{ github.event.inputs.release_name }}
35+
body: ${{ github.event.inputs.release_notes }}
36+
draft: ${{ github.event.inputs.release_type == 'draft' }} # not visible to the public
37+
prerelease: ${{ github.event.inputs.release_type == 'private' }} # visible only to collaborators
38+
39+
build:
40+
name: Build and Upload Artifacts
41+
needs: create_release
42+
runs-on: ${{ matrix.os }}
43+
strategy:
44+
matrix:
45+
os: [ubuntu-latest, macos-latest, windows-latest] # builds for each platform, in seperate vm's, in this order
46+
steps:
47+
- name: Checkout code
48+
uses: actions/checkout@v4
49+
50+
- name: Set up Node.js
51+
uses: actions/setup-node@v3
52+
with:
53+
node-version: "18"
54+
55+
- uses: actions/checkout@v3
56+
57+
- name: Set up Python
58+
uses: actions/setup-python@v4
59+
with:
60+
python-version: "3.12"
61+
62+
- name: Set up pip for Python
63+
run: |
64+
python --version
65+
pip --version || python -m ensurepip --upgrade
66+
python -m pip install --upgrade pip
67+
68+
- name: Install dependencies
69+
run: |
70+
corepack enable
71+
corepack prepare pnpm@latest --activate
72+
pnpm install-reqs
73+
74+
- name: Build icons
75+
run: pnpm build:icons
76+
77+
- name: Build Python sidecar
78+
run: |
79+
if [[ "${{ runner.os }}" == "Linux" ]]; then
80+
pnpm build:sidecar-linux
81+
elif [[ "${{ runner.os }}" == "macOS" ]]; then
82+
pnpm build:sidecar-macos
83+
elif [[ "${{ runner.os }}" == "Windows" ]]; then
84+
pnpm build:sidecar-winos
85+
fi
86+
87+
- name: Build Next.js
88+
run: pnpm run next build
89+
90+
- name: Set up Rust
91+
uses: actions-rs/toolchain@v1
92+
with:
93+
profile: minimal
94+
toolchain: stable # You can also specify a version, e.g., "1.72.0"
95+
override: true
96+
97+
- name: Build Tauri app
98+
run: pnpm tauri build
99+
100+
- name: Upload artifact
101+
uses: actions/upload-artifact@v3
102+
with:
103+
name: ${{ runner.os }}-artifact
104+
path: |
105+
if [[ "${{ runner.os }}" == "Windows" ]]; then
106+
echo "src-tauri/target/release/bundle/nsis/tauri-python-sidecar_0.1.0_x64_Windows-setup.zip"
107+
else
108+
echo "src-tauri/target/release/bundle/"
109+
fi
110+
111+
upload_assets:
112+
name: Upload Assets to Release
113+
needs: build
114+
runs-on: ubuntu-latest
115+
steps:
116+
- name: Download Linux artifact
117+
if: always()
118+
uses: actions/download-artifact@v3
119+
with:
120+
name: ubuntu-latest-artifact
121+
path: ./artifacts/ubuntu
122+
123+
- name: Download macOS artifact
124+
if: always()
125+
uses: actions/download-artifact@v3
126+
with:
127+
name: macos-latest-artifact
128+
path: ./artifacts/macos
129+
130+
- name: Download Windows artifact
131+
if: always()
132+
uses: actions/download-artifact@v3
133+
with:
134+
name: windows-latest-artifact
135+
path: ./artifacts/windows
136+
137+
- name: Upload Linux asset
138+
if: always()
139+
uses: actions/upload-release-asset@v1
140+
env:
141+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
142+
with:
143+
upload_url: ${{ needs.create_release.outputs.release_upload_url }}
144+
asset_path: ./artifacts/ubuntu/tauri-python-sidecar_${{ github.event.inputs.tag_name }}_x86_x64_Linux-setup.AppImage
145+
asset_name: tauri-python-sidecar_${{ github.event.inputs.tag_name }}_x86_x64_Linux-setup.AppImage
146+
asset_content_type: application/octet-stream
147+
148+
- name: Upload macOS asset
149+
if: always()
150+
uses: actions/upload-release-asset@v1
151+
env:
152+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
153+
with:
154+
upload_url: ${{ needs.create_release.outputs.release_upload_url }}
155+
asset_path: ./artifacts/macos/tauri-python-sidecar_${{ github.event.inputs.tag_name }}_x86_x64_macOS-setup.dmg
156+
asset_name: tauri-python-sidecar_${{ github.event.inputs.tag_name }}_x86_x64_macOS-setup.dmg
157+
asset_content_type: application/octet-stream
158+
159+
- name: Upload Windows asset
160+
if: always()
161+
uses: actions/upload-release-asset@v1
162+
env:
163+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
164+
with:
165+
upload_url: ${{ needs.create_release.outputs.release_upload_url }}
166+
asset_path: ./artifacts/windows/tauri-python-sidecar_${{ github.event.inputs.tag_name }}_x86_x64_Windows-setup.zip
167+
asset_name: tauri-python-sidecar_${{ github.event.inputs.tag_name }}_x86_x64_Windows-setup.zip
168+
asset_content_type: application/octet-stream

0 commit comments

Comments
 (0)