-
Notifications
You must be signed in to change notification settings - Fork 4
138 lines (122 loc) · 5.59 KB
/
create-builds.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
135
136
137
138
name: Generate App Installers
on:
pull_request:
types: [opened, synchronize, reopened, edited]
push:
branches:
- main
workflow_dispatch:
jobs:
build-installers:
permissions: write-all
strategy:
fail-fast: false
matrix:
include:
- platform: "macos-latest"
- platform: "ubuntu-latest"
- platform: "windows-latest"
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/[email protected]
- name: setup node
uses: actions/[email protected]
with:
node-version: lts/*
- name: install Rust stable
uses: dtolnay/rust-toolchain@stable
- name: install dependencies (ubuntu only)
if: matrix.platform == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf
- name: install frontend dependencies
run: npm install
- uses: tauri-apps/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload Ubuntu installer
if: matrix.platform == 'ubuntu-latest'
uses: actions/[email protected]
with:
name: build-ubuntu
path: src-tauri/target/release/bundle/deb/*.deb
retention-days: 5
- name: Build Web Assets 🔨
if: matrix.platform == 'ubuntu-latest'
run: npm run build
- name: Set up JDK
if: matrix.platform == 'ubuntu-latest'
uses: actions/[email protected]
with:
distribution: "temurin"
java-version: "21"
- name: Set up Android SDK
if: matrix.platform == 'ubuntu-latest'
uses: android-actions/[email protected]
- name: Sync Capacitor Assets 🔨
if: matrix.platform == 'ubuntu-latest'
run: npx cap sync && npx cap copy android && cd android && ./gradlew assembleDebug
- name: Upload APK
if: matrix.platform == 'ubuntu-latest'
uses: actions/[email protected]
with:
name: build-android
path: android/app/build/outputs/apk/debug/app-debug.apk
retention-days: 5
- name: Upload macOS installer
if: matrix.platform == 'macos-latest'
uses: actions/[email protected]
with:
name: build-macos
path: src-tauri/target/release/bundle/dmg/*.dmg
retention-days: 5
- name: Upload MSI installer
if: matrix.platform == 'windows-latest'
uses: actions/[email protected]
with:
name: build-windows
path: src-tauri/target/release/bundle/msi/*.msi
retention-days: 5
- name: Post Download Links for Artifacts
if: success()
uses: actions/[email protected]
with:
script: |
async function upsertComment(owner, repo, issue_number, purpose, body) {
const {data: comments} = await github.rest.issues.listComments(
{owner, repo, issue_number});
const marker = `<!-- bot: ${purpose} -->`;
body = marker + "\n" + body;
const existing = comments.filter((c) => c.body.includes(marker));
if (existing.length > 0) {
const last = existing[existing.length - 1];
console.info(`Updating comment ${last.id}`);
await github.rest.issues.updateComment({
owner, repo,
body,
comment_id: last.id,
});
} else {
console.info(`Creating a comment in issue / PR #${issue_number}`);
await github.rest.issues.createComment({issue_number, body, owner, repo});
}
}
const {owner, repo} = context.repo;
const run_id = ${{github.run_id}}; // Use current run id
const pull_requests = ${{ toJSON(github.event.pull_request) }};
if (!pull_requests) {
return core.error("This workflow doesn't match any pull requests!");
}
const artifacts = await github.paginate(
github.rest.actions.listWorkflowRunArtifacts, {owner, repo, run_id});
if (!artifacts.length) {
return core.error(`No artifacts found`);
}
let body = `Download the app installers for this pull request:\n`;
for (const art of artifacts) {
body += `\n* [${art.name}.zip](https://nightly.link/${owner}/${repo}/actions/artifacts/${art.id}.zip)`;
}
console.info("Review thread message body:", body);
await upsertComment(owner, repo, pull_requests.number,
"nightly-link", body);