Skip to content

Commit d74c8ee

Browse files
committed
feat(ci): add workflow
1 parent f7bef50 commit d74c8ee

2 files changed

Lines changed: 111 additions & 0 deletions

File tree

.github/workflows/build.yml

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
name: Build extension zip
2+
3+
on:
4+
push:
5+
branches: [typescript]
6+
tags: ["v*"]
7+
pull_request:
8+
branches: [typescript]
9+
workflow_dispatch:
10+
11+
# Read by default. The release job below opts into write.
12+
permissions:
13+
contents: read
14+
15+
env:
16+
UUID: hanabi-extension@jeffshee.github.io
17+
18+
jobs:
19+
build:
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v4
24+
25+
- name: Install system dependencies
26+
run: |
27+
sudo apt-get update
28+
sudo apt-get install -y meson ninja-build gettext libglib2.0-bin
29+
30+
- name: Setup Node.js
31+
uses: actions/setup-node@v4
32+
with:
33+
node-version: 20
34+
cache: npm
35+
36+
- name: Install npm dependencies
37+
run: npm ci
38+
39+
- name: Build TypeScript sources
40+
run: npm run build
41+
42+
- name: Assemble extension into a staging prefix
43+
run: |
44+
meson setup .build-ci --prefix=/usr
45+
DESTDIR="${GITHUB_WORKSPACE}/staging" meson install -C .build-ci
46+
47+
- name: Package zip installable with `gnome-extensions install`
48+
run: |
49+
ext="${GITHUB_WORKSPACE}/staging/usr/share/gnome-shell/extensions/${UUID}"
50+
# meson installs the gschema XML under the glib prefix; an installable
51+
# zip needs the schema (compiled) inside the extension's own schemas/ dir.
52+
mkdir -p "${ext}/schemas"
53+
cp "${GITHUB_WORKSPACE}"/staging/usr/share/glib-2.0/schemas/*.gschema.xml "${ext}/schemas/"
54+
glib-compile-schemas "${ext}/schemas/"
55+
mkdir -p "${GITHUB_WORKSPACE}/dist"
56+
( cd "${ext}" && zip -qr "${GITHUB_WORKSPACE}/dist/${UUID}.shell-extension.zip" . )
57+
echo "Packaged:"
58+
unzip -l "${GITHUB_WORKSPACE}/dist/${UUID}.shell-extension.zip"
59+
60+
- name: Upload zip artifact
61+
uses: actions/upload-artifact@v4
62+
with:
63+
name: ${{ env.UUID }}.shell-extension
64+
path: dist/*.shell-extension.zip
65+
if-no-files-found: error
66+
67+
# Separate job so write permission is granted only when publishing a release.
68+
release:
69+
needs: build
70+
if: startsWith(github.ref, 'refs/tags/v')
71+
runs-on: ubuntu-latest
72+
permissions:
73+
contents: write
74+
steps:
75+
- name: Download zip artifact
76+
uses: actions/download-artifact@v4
77+
with:
78+
name: ${{ env.UUID }}.shell-extension
79+
path: dist
80+
81+
- name: Attach zip to GitHub Release
82+
env:
83+
GH_TOKEN: ${{ github.token }}
84+
run: gh release create "${GITHUB_REF_NAME}" dist/*.shell-extension.zip --generate-notes

docs/dev.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,33 @@ Common development tasks are available via `make`:
1717

1818
Run `make help` to see all available targets.
1919

20+
## Release
21+
22+
Pushing a `v*` tag triggers the [`build.yml`](../.github/workflows/build.yml)
23+
workflow, which builds the zip and publishes a GitHub Release with it attached.
24+
25+
1. Bump `version:` in [`meson.build`](../meson.build) (a plain integer,
26+
incremented by 1 — GNOME uses it to detect updates), commit, and merge.
27+
2. Tag the release commit and push:
28+
29+
```bash
30+
git tag -a v1.0.0 -m "Release 1.0.0"
31+
git push origin v1.0.0
32+
```
33+
34+
To re-cut, delete the tag (and its Release) first:
35+
36+
```bash
37+
git tag -d v1.0.0 # local
38+
git push origin :refs/tags/v1.0.0 # remote
39+
```
40+
41+
Install the published zip with:
42+
43+
```bash
44+
gnome-extensions install hanabi-extension@jeffshee.github.io.shell-extension.zip
45+
```
46+
2047
## License Headers
2148

2249
License headers in `src/` are managed with [licensure](https://github.com/chasinglogic/licensure). Configuration is in [`.licensure.yml`](../.licensure.yml).

0 commit comments

Comments
 (0)