Repository navigation
197 lines (174 loc) · 7.5 KB
/
Copy pathlinux.yml
File metadata and controls
197 lines (174 loc) · 7.5 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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
name: Linux
# Builds the Linux app (AppImage, .deb, .rpm) from the same Tauri project as
# Windows. Triggered by tags like `linux-v0.1.0`, by hand, and by pull requests
# that touch windows/ or this file (build and test only); the macOS and Windows
# workflows are untouched.
#
# Two jobs on purpose. `build` runs npm, cargo and the AppImage tooling (which
# downloads its own helpers) with a read-only token that is not even kept on
# disk. Only `publish`, which runs none of that code, may write to the repo.
on:
push:
tags:
- 'linux-v*'
workflow_dispatch:
# Build and test only. A pull request never uploads artifacts and never
# reaches the publish job (see the two gates below), and a fork's token is
# read-only anyway.
pull_request:
paths:
- 'windows/**'
- '.github/workflows/linux.yml'
permissions:
contents: read
# On: a linux-v* tag publishes. Run this workflow by hand first and try the
# Coucou-Linux artifact; set this to 'false' to build tags without publishing.
env:
PUBLISH: 'true'
jobs:
build:
# The oldest supported Ubuntu: an AppImage only runs on systems whose glibc
# is at least as new as the one it was built against.
runs-on: ubuntu-22.04
outputs:
version: ${{ steps.pack.outputs.version }}
publish: ${{ steps.gate.outputs.publish }}
defaults:
run:
working-directory: windows
steps:
- uses: actions/checkout@v7
with:
persist-credentials: false
# webkit2gtk, gtk-layer-shell and appindicator to build against, ALSA for
# the microphone (Flow dictation, the Notetaker); patchelf and the
# GStreamer plugins for the AppImage, which carries its own GStreamer so
# the sounds play (WAV needs wavparse, in -good).
- name: Install system libraries
working-directory: .
run: |
sudo apt-get update
sudo apt-get install -y \
libwebkit2gtk-4.1-dev libgtk-layer-shell-dev libayatana-appindicator3-dev \
librsvg2-dev libssl-dev libdbus-1-dev libasound2-dev patchelf \
gstreamer1.0-plugins-base gstreamer1.0-plugins-good
- uses: actions/setup-node@v7
with:
node-version: 22
cache: npm
cache-dependency-path: windows/package-lock.json
- name: Cache cargo
uses: actions/cache@v6
with:
path: |
~/.cargo/registry
~/.cargo/git
windows/target
key: linux-cargo-${{ hashFiles('windows/Cargo.lock') }}
restore-keys: linux-cargo-
- name: Install dependencies
run: npm ci
# Same check as the Windows workflow: three files carry the version.
- name: Check the tag and every version agree
if: startsWith(github.ref, 'refs/tags/linux-v')
run: |
tag="${GITHUB_REF_NAME#linux-v}"
conf=$(node -p "require('./src-tauri/tauri.conf.json').version")
pkg=$(node -p "require('./package.json').version")
cargo=$(sed -nE 's/^version\s*=\s*"(.+)"/\1/p' Cargo.toml | head -1)
echo "tag=$tag tauri.conf=$conf package.json=$pkg Cargo.toml=$cargo"
bad=""
[ "$tag" = "$conf" ] || bad="$bad tauri.conf.json says $conf;"
[ "$tag" = "$pkg" ] || bad="$bad package.json says $pkg;"
[ "$tag" = "$cargo" ] || bad="$bad Cargo.toml says $cargo;"
if [ -n "$bad" ]; then echo "tag says $tag but$bad"; exit 1; fi
# The app bundles target/release/coucou-hook as a resource, and its build
# script refuses to run until that file exists.
- name: Test
run: |
cargo build --release -p coucou-hook
cargo test --workspace
# linuxdeploy is itself an AppImage; runners have no FUSE, so it unpacks
# itself instead of mounting.
- name: Build and pack
id: pack
env:
APPIMAGE_EXTRACT_AND_RUN: '1'
run: |
npm run pack
echo "version=$(node -p "require('./src-tauri/tauri.conf.json').version")" >> "$GITHUB_OUTPUT"
cd release
sha256sum Coucou-Linux-* > SHA256SUMS
ls -la
cat SHA256SUMS
- name: Decide whether to publish
id: gate
run: echo "publish=${{ github.event_name == 'push' && env.PUBLISH == 'true' && startsWith(github.ref, 'refs/tags/linux-v') }}" >> "$GITHUB_OUTPUT"
# Upload only on a manual run or when publishing a release, as on Windows.
# The repo is public, so artifacts are downloadable by any signed-in GitHub
# user; retention-days: 3 limits exposure.
- uses: actions/upload-artifact@v7
if: github.event_name == 'workflow_dispatch' || steps.gate.outputs.publish == 'true'
with:
name: Coucou-Linux
path: |
windows/release/Coucou-Linux-*
windows/release/SHA256SUMS
retention-days: 3
publish:
needs: build
# Checked again here, so a pull request can never get this far whatever
# the build job reports.
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/linux-v') && needs.build.outputs.publish == 'true'
runs-on: ubuntu-22.04
permissions:
contents: write
steps:
# Only for the linux-latest tag below; nothing from the repo is run.
- uses: actions/checkout@v7
- uses: actions/download-artifact@v8
with:
name: Coucou-Linux
path: release
- name: Publish the release
env:
GH_TOKEN: ${{ github.token }}
VERSION: ${{ needs.build.outputs.version }}
run: |
v="$VERSION"
notes="Coucou for Linux $v — Mochi at the top of your screen.
- **AppImage** (any distribution): \`chmod +x Coucou-Linux-$v-x86_64.AppImage\` and run it.
- **Debian / Ubuntu**: \`sudo apt install ./Coucou-Linux-$v-amd64.deb\`
- **Fedora / openSUSE**: \`sudo dnf install ./Coucou-Linux-$v-x86_64.rpm\`
Check a download with \`sha256sum -c SHA256SUMS --ignore-missing\`.
The island sits on the top edge on compositors with layer-shell (COSMIC,
KDE Plasma, Hyprland, Sway…). On GNOME it opens as a regular window."
# --latest=false: the macOS \`v*\` releases own the Latest slot, which
# the site's Download for Mac button points at.
gh release create "$GITHUB_REF_NAME" \
"release/Coucou-Linux-$v-x86_64.AppImage" \
"release/Coucou-Linux-$v-amd64.deb" \
"release/Coucou-Linux-$v-x86_64.rpm" \
"release/SHA256SUMS" \
--title "Coucou for Linux $v" \
--notes "$notes" \
--latest=false
- name: Update the rolling linux-latest release
env:
GH_TOKEN: ${{ github.token }}
VERSION: ${{ needs.build.outputs.version }}
run: |
v="$VERSION"
if gh release view linux-latest >/dev/null 2>&1; then
# The tag has to follow the release, as for windows-latest.
git tag -f linux-latest "$GITHUB_SHA"
git push -f origin linux-latest
gh release edit linux-latest --title "Coucou for Linux (latest)" --notes "Always the newest Linux build — currently $v."
gh release upload linux-latest "release/Coucou-Linux-x86_64.AppImage" --clobber
else
gh release create linux-latest \
"release/Coucou-Linux-x86_64.AppImage" \
--title "Coucou for Linux (latest)" \
--notes "Always the newest Linux build — currently $v." \
--latest=false
fi