-
Notifications
You must be signed in to change notification settings - Fork 2
156 lines (141 loc) · 5.32 KB
/
app-build-release.yml
File metadata and controls
156 lines (141 loc) · 5.32 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
name: 'app-build-release'
on:
pull_request:
paths:
- 'apps/app/**'
- '.github/workflows/tauri-build-release.yml'
push:
branches:
- main
paths:
- 'apps/app/**'
- '.github/workflows/tauri-build-release.yml'
workflow_dispatch:
jobs:
publish-tauri:
environment: production
permissions:
contents: write
strategy:
fail-fast: false
matrix:
include:
- platform: 'macos-latest' # for Arm based macs (M1 and above).
args: '--target aarch64-apple-darwin'
- platform: 'macos-latest' # for Intel based macs.
args: '--target x86_64-apple-darwin'
- platform: 'ubuntu-22.04'
args: ''
- platform: 'ubuntu-22.04-arm'
args: ''
- platform: 'windows-2022'
args: ''
- platform: 'windows-11-arm'
args: ''
- platform: 'ubuntu-22.04'
args: '--apk true --split-per-abi --target aarch64 --target armv7'
mobile: 'android'
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v6
# ------------- Node & Frontend Cache -------------
- name: setup node
uses: actions/setup-node@v4
with:
node-version: lts/*
- name: setup bun
uses: oven-sh/setup-bun@v2
# NEW: Cache Bun dependencies
- name: Cache Bun dependencies
uses: actions/cache@v4
with:
path: ~/.bun/install/cache
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lockb') }}
restore-keys: |
${{ runner.os }}-bun-
# Case 1: Run bun for everything EXCEPT Windows ARM
- name: install frontend dependencies
if: matrix.platform != 'windows-11-arm'
run: bun i
# Case 2: Run npm ONLY for Windows ARM
- name: install frontend dependencies (Windows ARM)
if: matrix.platform == 'windows-11-arm'
run: npm install
# ------------- Rust & Cargo Cache -------------
- name: install Rust stable (desktop)
if: matrix.mobile == ''
uses: dtolnay/rust-toolchain@stable
with:
targets: aarch64-apple-darwin,x86_64-apple-darwin
- name: install Rust stable (android)
if: matrix.mobile == 'android'
uses: dtolnay/rust-toolchain@stable
with:
targets: aarch64-linux-android,armv7-linux-androideabi,i686-linux-android,x86_64-linux-android
# MODIFIED: Fixed workspaces syntax and ensured shared key matches matrix
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
# Point this to the folder containing Cargo.toml.
# The action automatically handles the 'target' directory.
workspaces: apps/app/src-tauri
# Adding a key based on the job matrix helps prevent cache conflicts between platforms
key: ${{ matrix.platform }}-${{ matrix.args }}
# ------------- Android -------------
- name: Set up JDK
if: matrix.mobile == 'android'
uses: actions/setup-java@v5
with:
java-version: '17'
distribution: 'temurin'
# NEW: Cache Gradle for Android
- name: Cache Gradle
if: matrix.mobile == 'android'
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Setup Android SDK
if: matrix.mobile == 'android'
uses: android-actions/setup-android@v3
- name: Setup Android NDK
if: matrix.mobile == 'android'
uses: nttld/setup-ndk@v1
id: setup-ndk
with:
ndk-version: r29
link-to-sdk: true
- name: setup Android signing
if: matrix.mobile == 'android'
run: |
cd apps/app/src-tauri/gen/android
echo "keyAlias=${{ secrets.ANDROID_KEY_ALIAS }}" > keystore.properties
echo "password=${{ secrets.ANDROID_KEY_PASSWORD }}" >> keystore.properties
base64 -d <<< "${{ secrets.ANDROID_KEY_BASE64 }}" > $RUNNER_TEMP/keystore.jks
echo "storeFile=$RUNNER_TEMP/keystore.jks" >> keystore.properties
# ------------ Desktop OS ----------------
- name: install dependencies (ubuntu only)
if: startsWith(matrix.platform, 'ubuntu')
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev xdg-utils
# ---------------- Tauri -----------------
- name: Build Tauri Project
uses: tauri-apps/tauri-action@e3ec38d49ea445df6d61ebaf015a85b1846b63f3
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }}
with:
projectPath: 'apps/app'
tagName: v__VERSION__ # the action automatically replaces \_\_VERSION\_\_ with the app version.
releaseName: 'Cherit v__VERSION__'
releaseAssetNamePattern: '[name]-[platform]-[arch][ext]'
releaseBody: 'Download from Website : [Download](https://keshav.is-a.dev/Cherit/download/)'
releaseDraft: true
prerelease: false
args: ${{ matrix.args }}
mobile: ${{ matrix.mobile }}