-
Notifications
You must be signed in to change notification settings - Fork 0
178 lines (155 loc) · 6.02 KB
/
main.yml
File metadata and controls
178 lines (155 loc) · 6.02 KB
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
name: 'publish'
on:
push:
tags:
- '*' # Only run on tag pushes.
env:
APP_NAME: "Super-Note"
jobs:
changelog:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Build changelog
id: build_changelog
run: |
PREV_TAG=$(git tag --list v* | tail -n2 | head -n1)
echo "changelog=$(git log $PREV_TAG...${{ github.ref_name }} --pretty=format:"- %s")" >> $GITHUB_OUTPUT
outputs:
changelog: ${{ steps.build_changelog.outputs.changelog }}
release:
environment: production
permissions:
contents: write
strategy:
fail-fast: false
matrix:
include:
# Windows Desktop Build
- os: windows-latest
rust-target: ''
tauri-args: ''
type: 'desktop'
# macOS ARM Build
- os: macos-latest
rust-target: 'aarch64-apple-darwin'
tauri-args: '--target aarch64-apple-darwin'
type: 'desktop'
# macOS Intel Build
- os: macos-latest
rust-target: 'x86_64-apple-darwin'
tauri-args: '--target x86_64-apple-darwin'
type: 'desktop'
# Linux Desktop Build
- os: ubuntu-22.04
rust-target: ''
tauri-args: '--bundles deb,rpm,updater'
type: 'desktop'
# Android Build
- os: ubuntu-latest
rust-target: 'aarch64-linux-android,armv7-linux-androideabi,i686-linux-android,x86_64-linux-android'
tauri-args: ''
type: 'android'
runs-on: ${{ matrix.os }}
needs: [changelog]
steps:
- uses: actions/checkout@v4
- name: setup Android signing
if: matrix.type == 'android'
run: |
cd src-tauri/gen/android
echo "keyAlias=${{ secrets.ANDROID_RELEASE_KEY }}" > keystore.properties
echo "password=${{ secrets.ANDROID_RELEASE_PASSWORD }}" >> keystore.properties
base64 -d <<< "${{ secrets.ANDROID_KEYSTORE_BASE64 }}" > $RUNNER_TEMP/uploadkeystore.jks
echo "storeFile=$RUNNER_TEMP/uploadkeystore.jks" >> keystore.properties
- uses: pnpm/action-setup@v4
with:
version: 8
- name: Setup Java
if: matrix.type == 'android'
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- name: Setup Android SDK
if: matrix.type == 'android'
uses: android-actions/setup-android@v3
- name: Install NDK
if: matrix.type == 'android'
run: sdkmanager "ndk;27.0.11902837"
- name: setup node
uses: actions/setup-node@v4
with:
node-version: lts/*
- name: install Bun (Desktop only)
if: matrix.type == 'desktop'
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: setup Python (Desktop only)
if: matrix.type == 'desktop'
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: install PyInstaller (Desktop only)
if: matrix.type == 'desktop'
run: pip install pyinstaller
- name: install Rust stable
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.rust-target }}
- name: install dependencies (ubuntu only)
if: matrix.os == 'ubuntu-22.04'
run: |
sudo apt-get update
sudo apt-get install -y build-essential libssl-dev libgtk-3-dev libwebkit2gtk-4.1-dev libayatana-appindicator3-dev librsvg2-dev patchelf libfuse2 libjavascriptcoregtk-4.1-dev libsoup-3.0-dev file
- name: install frontend dependencies
run: pnpm install
- name: Build Tauri app
if: matrix.type == 'desktop'
uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
# Compatibility with some versions of the action
TAURI_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
TAURI_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
APPIMAGE_EXTRACT_AND_RUN: 1
with:
tagName: ${{ github.ref_name }}
releaseName: "${{ env.APP_NAME }} ${{ github.ref_name }}"
releaseBody: |
${{needs.changelog.outputs.changelog}}
See the assets to download this version and install.
releaseDraft: false
prerelease: false
args: ${{ matrix.tauri-args }}
includeUpdaterJson: ${{ matrix.upload-updater || false }}
- name: Extract version from tag
if: matrix.type == 'android'
id: package-version
run: echo "current-version=${GITHUB_REF_NAME#v}" >> $GITHUB_OUTPUT
- name: Build app bundle
if: matrix.type == 'android'
run: pnpm tauri android build -v
env:
NDK_HOME: ${{ env.ANDROID_HOME }}/ndk/27.0.11902837
- name: Rename APK file
if: matrix.type == 'android'
run: |
# Create a guaranteed safe destination folder
mkdir -p ./src-tauri/gen/android/app/build/outputs/apk/final_release
# Find any APK generated and move it there with the new name
find ./src-tauri/gen/android/app/build/outputs/apk/ -type f -name "*.apk" -exec mv {} ./src-tauri/gen/android/app/build/outputs/apk/final_release/${{ env.APP_NAME }}-${{ steps.package-version.outputs.current-version }}.apk \;
- name: Build Android App Bundle
if: matrix.type == 'android'
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ github.ref_name }}
name: "${{ env.APP_NAME }} ${{ github.ref_name }}"
draft: false
prerelease: false
files: |
./src-tauri/gen/android/app/build/outputs/apk/final_release/${{ env.APP_NAME }}-${{ steps.package-version.outputs.current-version }}.apk