-
Notifications
You must be signed in to change notification settings - Fork 39
134 lines (120 loc) · 4.77 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
name: Publish Release
on:
push:
tags:
- 'v*'
branches: '*'
workflow_dispatch:
env:
APP_NAME: "Sample Desktop App"
jobs:
changelog:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Build changelog
id: build_changelog
run: |
# NOTE: if commits subjects are standardized, you can filter the git log based on feat: and fix:
# and then replace "feat:" with "New: " and "fix:" with "Fixed "
# when AI gets good, we can also summarized commits into a bullet point list
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:
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: 'windows-latest'
args: ''
runs-on: ${{ matrix.platform }}
needs: [changelog]
steps:
- name: Checkout repository
uses: actions/checkout@v4
# build the changelog based on the commit messages between the versioned tags
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9
- name: Setup Node.js
uses: actions/setup-node@v4
# NOTE: enterprise developers may hard code a version
with:
node-version: 'lts/*'
cache: pnpm
# node-version-file: '.nvmrc'
- name: Install Rust stable
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.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }}
- name: Rust cache
uses: swatinem/rust-cache@v2
with:
workspaces: './src-tauri -> target'
- name: Install Ubuntu dependencies
if: matrix.platform == 'ubuntu-latest'
run: |
sudo apt update
xargs sudo apt install -y < environment/apt_packages.txt
- name: Install frontend dependencies
run: |
pnpm install
- name: CI Build
if: ${{ github.ref_type == 'branch' }}
run: |
pnpm rls
- name: CI upload Windows
if: ${{ github.ref_type == 'branch' && matrix.platform == 'windows-latest' }}
uses: actions/upload-artifact@v4
with:
name: 'Windows Installers'
path: |
src-tauri/release/bundle/msi/*.msi
src-tauri/release/bundle/nsis/*.exe
- name: CI upload macOS
if: ${{ github.ref_type == 'branch' && matrix.platform == 'macos-latest' }}
uses: actions/upload-artifact@v4
with:
name: 'macOS Installer'
path: |
src-tauri/release/bundle/dmg/*.dmg
- name: CI upload Linux
if: ${{ github.ref_type == 'branch' && matrix.platform == 'ubuntu-latest' }}
uses: actions/upload-artifact@v4
with:
name: 'Linux Distributions'
path: |
src-tauri/target/release/bundle/deb/*.deb
src-tauri/target/release/bundle/AppImage/*.AppImage
# TODO: https://tauri.app/v1/guides/building/linux#cross-compiling-tauri-applications-for-arm-based-devices
- name: Build Tauri app
uses: tauri-apps/tauri-action@v0
if: ${{ github.ref_type == 'tag' }}
# if u get Error: Resource not accessible by integration
# go to repository Settings => Action => General => Workflow permissions => Switch to Read and Write permisions
env:
CI: true
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 }}
with:
# tauri-action replaces \_\_VERSION\_\_ with the app version
tagName: ${{ github.ref_name }}
releaseName: "${{ env.APP_NAME }} v__VERSION__"
releaseBody: |
${{needs.changelog.outputs.changelog}}
See the assets to download this version and install.
releaseDraft: true
prerelease: false
args: ${{ matrix.args }}