-
Notifications
You must be signed in to change notification settings - Fork 1
113 lines (99 loc) · 3.43 KB
/
Copy pathrelease.yml
File metadata and controls
113 lines (99 loc) · 3.43 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
name: Release
on:
push:
tags:
- 'flicker-v*'
workflow_dispatch:
permissions:
contents: write
jobs:
# Create (or reuse) a single draft release first. Matrix build jobs below
# upload into this release by id instead of each trying to create their
# own - running them all in parallel without this step causes GitHub
# Actions to race and create duplicate draft releases.
create-release:
runs-on: ubuntu-latest
outputs:
release_id: ${{ steps.release.outputs.result }}
tag_name: ${{ steps.version.outputs.tag }}
steps:
- uses: actions/checkout@v4
- name: Read version
id: version
run: |
VERSION=$(jq -r .version src-tauri/tauri.conf.json)
echo "tag=flicker-v$VERSION" >> "$GITHUB_OUTPUT"
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
- name: Create or reuse draft release
id: release
uses: actions/github-script@v7
with:
script: |
const tag = '${{ steps.version.outputs.tag }}';
const version = '${{ steps.version.outputs.version }}';
const { owner, repo } = context.repo;
try {
const { data } = await github.rest.repos.getReleaseByTag({ owner, repo, tag });
return data.id;
} catch (error) {
if (error.status !== 404) throw error;
const { data } = await github.rest.repos.createRelease({
owner,
repo,
tag_name: tag,
name: `Flicker v${version}`,
draft: true,
prerelease: false,
});
return data.id;
}
build:
needs: create-release
strategy:
fail-fast: false
matrix:
include:
- platform: windows-latest
args: ''
- platform: macos-latest
args: '--target aarch64-apple-darwin'
- platform: macos-latest
args: '--target x86_64-apple-darwin'
- platform: ubuntu-22.04
args: ''
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v4
- name: Install Linux system dependencies
if: matrix.platform == 'ubuntu-22.04'
run: |
sudo apt-get update
sudo apt-get install -y \
libwebkit2gtk-4.1-dev \
libappindicator3-dev \
librsvg2-dev \
patchelf \
xdg-utils
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
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 Bun
uses: oven-sh/setup-bun@v2
- name: Install frontend dependencies
run: bun install
- name: Build and upload
uses: tauri-apps/tauri-action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Only needed once updater signing is configured (see README's
# Distribution section) - safe to leave unset until then.
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
with:
releaseId: ${{ needs.create-release.outputs.release_id }}
args: ${{ matrix.args }}