Skip to content

Translated using Weblate (Chinese (Simplified Han script)) #31

Translated using Weblate (Chinese (Simplified Han script))

Translated using Weblate (Chinese (Simplified Han script)) #31

Workflow file for this run

name: Build extension zip
on:
push:
branches: [main]
tags: ["v*"]
pull_request:
branches: [main]
workflow_dispatch:
# Read by default. The release job below opts into write.
permissions:
contents: read
env:
UUID: hanabi-extension@jeffshee.github.io
jobs:
# Static analysis only; no system deps needed, so it runs alongside build.
check:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: 20
cache: npm
# The lint toolchain has its own manifest under tools/.
cache-dependency-path: |
package-lock.json
tools/package-lock.json
- name: Install npm dependencies
run: npm ci
# eslint-config-gnome and ci-run-eslint live in tools/, not the root
# manifest. Installing here keeps `npm run lint` from doing it implicitly.
- name: Install lint toolchain
run: npm ci
working-directory: tools
- name: Typecheck
run: npm run typecheck
# Runs even if typecheck failed, so one run reports both.
- name: Lint
if: '!cancelled()'
run: npm run lint
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y meson ninja-build gettext libglib2.0-bin
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: 20
cache: npm
- name: Install npm dependencies
run: npm ci
- name: Build TypeScript sources
run: npm run build
- name: Assemble extension into a staging prefix
run: |
meson setup .build-ci --prefix=/usr
DESTDIR="${GITHUB_WORKSPACE}/staging" meson install -C .build-ci
- name: Package zip installable with `gnome-extensions install`
run: |
ext="${GITHUB_WORKSPACE}/staging/usr/share/gnome-shell/extensions/${UUID}"
# meson installs the gschema XML under the glib prefix; an installable
# zip needs the schema (compiled) inside the extension's own schemas/ dir.
mkdir -p "${ext}/schemas"
cp "${GITHUB_WORKSPACE}"/staging/usr/share/glib-2.0/schemas/*.gschema.xml "${ext}/schemas/"
glib-compile-schemas "${ext}/schemas/"
mkdir -p "${GITHUB_WORKSPACE}/dist"
( cd "${ext}" && zip -qr "${GITHUB_WORKSPACE}/dist/${UUID}.shell-extension.zip" . )
echo "Packaged:"
unzip -l "${GITHUB_WORKSPACE}/dist/${UUID}.shell-extension.zip"
# archive: false uploads the file as-is without GitHub's zip wrapper.
- name: Upload zip artifact
uses: actions/upload-artifact@v7
with:
name: ${{ env.UUID }}.shell-extension.zip
path: dist/${{ env.UUID }}.shell-extension.zip
archive: false
if-no-files-found: error
# Separate job so write permission is granted only when publishing a release.
release:
needs: build
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download zip artifact
uses: actions/download-artifact@v8
with:
name: ${{ env.UUID }}.shell-extension.zip
path: dist
# Keep the .zip as-is; do not decompress the downloaded file.
skip-decompress: true
- name: Attach zip to GitHub Release
env:
GH_TOKEN: ${{ github.token }}
run: gh release create "${GITHUB_REF_NAME}" dist/*.shell-extension.zip --generate-notes