Files
breeze/.github/workflows/release.yml
T
waozi b0e206ae13 Leave the visual suites out of CI and the release checks
make visual-test still runs them locally.
2026-10-23 02:39:36 -03:00

1663 lines
59 KiB
YAML

name: Release
on:
push:
branches:
- master
paths:
- 'src/**'
- '!src/cells/versions.zi'
- 'droid/**'
- 'apps/publishers.json'
- 'CHANGELOG.md'
- 'Makefile'
- 'mk/**'
- 'tests/**'
- 'ziran.lock'
- 'scripts/**'
- '!scripts/package-release.py'
- '!scripts/practice_content.py'
- '!scripts/update-package-version.py'
- '!scripts/generate-package-versions.py'
- '!scripts/prepare-package-assets.py'
- '!scripts/check-package-versions.py'
- '!scripts/package-manifests.py'
- 'packaging/**'
- '.github/workflows/release.yml'
- '.github/android-sdk-packages.txt'
- '.github/scripts/**'
- '.github/apt/**'
workflow_dispatch:
inputs:
revision:
description: Exact committed release candidate (defaults to the triggering commit)
required: false
type: string
reuse_run:
description: Verified Release run to reuse when only its phone-check receipt was added
required: false
type: string
permissions:
contents: write
actions: read
concurrency:
group: ${{ github.workflow }}-${{ inputs.revision || github.sha }}
cancel-in-progress: false
jobs:
secret-scan:
name: Secret Scan
runs-on: ubuntu-latest
outputs:
reuse_artifacts: ${{ steps.reuse.outputs.reuse_artifacts }}
steps:
- name: Require an immutable candidate
env:
CANDIDATE: ${{ inputs.revision || github.sha }}
run: |
if ! [[ "$CANDIDATE" =~ ^[0-9a-f]{40}$ ]]; then
echo "::error::revision must be a full commit ID, never a branch or tag"
exit 1
fi
- name: Checkout Repository
uses: actions/checkout@v4
with:
ref: ${{ inputs.revision || github.sha }}
fetch-depth: 0
- name: Verify identical source and every gate before reusing artifacts
id: reuse
env:
GH_TOKEN: ${{ github.token }}
VERIFIED_RUN: ${{ inputs.reuse_run }}
CANDIDATE: ${{ inputs.revision || github.sha }}
run: |
python3 - <<'PY'
import json
import os
from pathlib import Path
import re
import subprocess
run_id = os.environ.get('VERIFIED_RUN', '')
output = Path(os.environ['GITHUB_OUTPUT'])
if not run_id:
with output.open('a') as stream:
stream.write('reuse_artifacts=false\n')
raise SystemExit(0)
if not re.fullmatch(r'[1-9][0-9]*', run_id):
raise SystemExit('A numeric verified Release run ID is required')
repository = os.environ['GITHUB_REPOSITORY']
def api(path):
return json.loads(subprocess.check_output(['gh', 'api', path], text=True))
run = api(f'repos/{repository}/actions/runs/{run_id}')
if (run['path'] != '.github/workflows/release.yml' or
run['event'] != 'push' or run['head_branch'] != 'master' or
run['repository']['full_name'] != repository):
raise SystemExit('Artifacts must come from this repository master Release workflow')
source = run['head_sha']
candidate = os.environ['CANDIDATE']
if (not re.fullmatch(r'[0-9a-f]{40}', source) or
not re.fullmatch(r'[0-9a-f]{40}', candidate)):
raise SystemExit('The verified source must be an immutable commit')
subprocess.run(['git', 'merge-base', '--is-ancestor', source, candidate], check=True)
version = subprocess.check_output(
['python3', 'scripts/check-version.py', '--print-version'], text=True).strip()
receipt = f'releases/phone-checks/{version}.json'
changed = subprocess.check_output(
['git', 'diff', '--name-only', '--no-renames', source, candidate], text=True).splitlines()
if changed != [receipt]:
raise SystemExit('Reuse requires identical source with only the phone-check receipt added')
if subprocess.run(['git', 'cat-file', '-e', source + ':' + receipt],
capture_output=True).returncode == 0:
raise SystemExit('The source run already had a phone receipt; do not race its publication')
subprocess.run(['python3', 'scripts/check-phone-check.py', version,
'--revision', candidate], check=True)
required = {
'Secret Scan', 'Test (0/3)', 'Test (1/3)', 'Test (2/3)',
'F-Droid / F-Droid security and clean build', 'Verify F-Droid reproducibility',
'Build Web', 'Build Chrome Extension', 'Build Firefox Add-on', 'Build Windows',
'Build Android',
'Build Linux AppImage (x86_64, ubuntu-22.04, x86_64)',
'Build Linux AppImage (aarch64, ubuntu-22.04-arm, aarch64)',
'Build Linux Deb (amd64, ubuntu-22.04)', 'Build Linux Deb (arm64, ubuntu-22.04-arm)',
'Build Linux RPM (x86_64, ubuntu-22.04)', 'Build Linux RPM (aarch64, ubuntu-22.04-arm)',
'Build Linux Snap (x86_64, ubuntu-22.04)', 'Build Linux Snap (aarch64, ubuntu-22.04-arm)',
'Build Linux Flatpak (x86_64, ubuntu-22.04)', 'Build Linux Flatpak (aarch64, ubuntu-22.04-arm)',
}
jobs = api(f'repos/{repository}/actions/runs/{run_id}/jobs?per_page=100')['jobs']
for name in required:
matches = [job for job in jobs if job['name'] == name]
if (len(matches) != 1 or matches[0]['status'] != 'completed' or
matches[0]['conclusion'] != 'success'):
raise SystemExit(name + ' must have passed for the identical source')
ci_runs = api(f'repos/{repository}/actions/workflows/ci.yml/runs?head_sha={source}&event=push&per_page=100')['workflow_runs']
matching = [item for item in ci_runs if item['head_sha'] == source and
item['path'] == '.github/workflows/ci.yml' and item['event'] == 'push' and
item['head_branch'] == 'master' and item['status'] == 'completed' and
item['conclusion'] == 'success']
if len(matching) != 1:
raise SystemExit('The identical source must also pass CI, including browser add-on smoke tests')
with output.open('a') as stream:
stream.write('reuse_artifacts=true\n')
print('All source, test, platform and F-Droid gates passed; reusing their immutable artifacts')
PY
- name: Fetch Ziran packages
uses: ./.github/actions/ziran-packages
with:
save-toolchain: 'false'
- name: Require configured app publisher
run: python3 scripts/check-package-publishers.py
- name: Check Version Consistency
run: |
python3 scripts/check-version.py
python3 tests/version_test.py
- name: Scan Tracked Files and History
run: |
set -euo pipefail
python3 scripts/check-secrets.py --working-tree
python3 scripts/check-secrets.py --history
test:
if: needs.secret-scan.outputs.reuse_artifacts != 'true'
name: Test (${{ matrix.shard }}/3)
runs-on: ubuntu-latest
needs: secret-scan
# Run every unit shard and the package compatibility suite.
timeout-minutes: 120
strategy:
fail-fast: false
matrix:
shard: [0, 1, 2]
env:
APT_CACHE_DIR: /tmp/apt-cache
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
ref: ${{ inputs.revision || github.sha }}
fetch-depth: 1
lfs: true
- name: Fetch Ziran packages
uses: ./.github/actions/ziran-packages
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 22
# Robolectric's Android 16 (SDK 36) sandbox needs Java 21.
- name: Set up Java
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '21'
- name: Cache Test apt packages
uses: actions/cache@v4
with:
path: ${{ env.APT_CACHE_DIR }}
key: test-apt-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('.github/apt/test-packages.txt') }}
restore-keys: |
test-apt-${{ runner.os }}-${{ runner.arch }}-
- name: Install Test Dependencies
timeout-minutes: 15
run: .github/scripts/install-apt-packages.sh .github/apt/test-packages.txt
- name: Run Tests
run: sh scripts/test-shard.sh ${{ matrix.shard }} 3
- name: Run Packages Across App Versions
if: matrix.shard == 2
run: make package-compat-test
env:
GITHUB_TOKEN: ${{ github.token }}
fdroid:
if: needs.secret-scan.outputs.reuse_artifacts != 'true'
name: F-Droid
needs: secret-scan
uses: ./.github/workflows/fdroid.yml
with:
revision: ${{ inputs.revision || github.sha }}
verify-fdroid:
name: Verify F-Droid reproducibility
runs-on: ubuntu-latest
needs: [secret-scan, fdroid, build-android]
if: needs.secret-scan.outputs.reuse_artifacts != 'true'
timeout-minutes: 15
steps:
- name: Download independent F-Droid build
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
github-token: ${{ github.token }}
run-id: ${{ inputs.reuse_run || github.run_id }}
name: fdroid-unsigned
path: fdroid
- name: Download signed Android release
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
github-token: ${{ github.token }}
run-id: ${{ inputs.reuse_run || github.run_id }}
name: release-android
path: signed
- name: Require the rebuilt APK to accept the release signature
run: |
set -euo pipefail
sudo apt-get update
sudo apt-get install -y apksigcopier apksigner
mapfile -t rebuilt < <(find fdroid/tmp -name '*.apk')
mapfile -t signed < <(find signed -name '*-fdroid.apk')
test "${#rebuilt[@]}" -eq 1
test "${#signed[@]}" -eq 1
apksigner verify --print-certs "${signed[0]}" | tee signer.txt
grep -Fx 'Signer #1 certificate SHA-256 digest: 47648dc7665db12a97c3077a4892ce29072c756bb31b5c331b8924493c888475' signer.txt
apksigcopier compare --unsigned "${signed[0]}" "${rebuilt[0]}"
build-web:
if: needs.secret-scan.outputs.reuse_artifacts != 'true'
name: Build Web
runs-on: ubuntu-latest
timeout-minutes: 60
needs: secret-scan
env:
APT_CACHE_DIR: /tmp/apt-cache
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
ref: ${{ inputs.revision || github.sha }}
fetch-depth: 1
lfs: true
- name: Fetch Ziran packages
uses: ./.github/actions/ziran-packages
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 22
- name: Cache Web apt packages
uses: actions/cache@v4
with:
path: ${{ env.APT_CACHE_DIR }}
key: web-apt-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('.github/apt/web-packages.txt') }}
restore-keys: |
web-apt-${{ runner.os }}-${{ runner.arch }}-
- name: Install Web Dependencies
timeout-minutes: 15
run: .github/scripts/install-apt-packages.sh .github/apt/web-packages.txt
- name: Set up Emscripten
uses: ./.github/actions/emscripten
- name: Build Web ZIP
run: |
set -euo pipefail
export PATH="$INBE_NODE_BIN:$PATH"
node --version
make package-unpackaged-assets
make web
mkdir -p build/release/web
cp build/dist/inbe-web.zip build/release/web/
- name: Upload Web Artifact
uses: actions/upload-artifact@v4
with:
name: release-web
path: build/release/web/*
if-no-files-found: error
build-chrome-extension:
if: needs.secret-scan.outputs.reuse_artifacts != 'true'
name: Build Chrome Extension
runs-on: ubuntu-latest
timeout-minutes: 60
needs: secret-scan
env:
APT_CACHE_DIR: /tmp/apt-cache
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
ref: ${{ inputs.revision || github.sha }}
fetch-depth: 1
lfs: true
- name: Fetch Ziran packages
uses: ./.github/actions/ziran-packages
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 22
- name: Cache Web apt packages
uses: actions/cache@v4
with:
path: ${{ env.APT_CACHE_DIR }}
key: web-apt-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('.github/apt/web-packages.txt') }}
restore-keys: |
web-apt-${{ runner.os }}-${{ runner.arch }}-
- name: Install Web Dependencies
timeout-minutes: 15
run: .github/scripts/install-apt-packages.sh .github/apt/web-packages.txt
- name: Set up Emscripten
uses: ./.github/actions/emscripten
- name: Build Chrome Extension ZIP
run: |
set -euo pipefail
export PATH="$INBE_NODE_BIN:$PATH"
node --version
make package-unpackaged-assets
make chrome-web-store
mkdir -p build/release/chrome-web-store
cp build/dist/inbe-chrome-web-store.zip build/release/chrome-web-store/
- name: Upload Chrome Extension Artifact
uses: actions/upload-artifact@v4
with:
name: release-chrome-web-store
path: build/release/chrome-web-store/*
if-no-files-found: error
build-firefox-addons:
if: needs.secret-scan.outputs.reuse_artifacts != 'true'
name: Build Firefox Add-on
runs-on: ubuntu-latest
timeout-minutes: 60
needs: secret-scan
env:
APT_CACHE_DIR: /tmp/apt-cache
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
ref: ${{ inputs.revision || github.sha }}
fetch-depth: 1
lfs: true
- name: Fetch Ziran packages
uses: ./.github/actions/ziran-packages
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 22
- name: Cache Web apt packages
uses: actions/cache@v4
with:
path: ${{ env.APT_CACHE_DIR }}
key: web-apt-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('.github/apt/web-packages.txt') }}
restore-keys: |
web-apt-${{ runner.os }}-${{ runner.arch }}-
- name: Install Web Dependencies
timeout-minutes: 15
run: .github/scripts/install-apt-packages.sh .github/apt/web-packages.txt
- name: Set up Emscripten
uses: ./.github/actions/emscripten
- name: Build Firefox Add-on ZIP
run: |
set -euo pipefail
export PATH="$INBE_NODE_BIN:$PATH"
node --version
make package-unpackaged-assets
make firefox-addons
make firefox-addons-lint
mkdir -p build/release/firefox-addons
cp build/dist/inbe-firefox-addons.zip build/release/firefox-addons/
- name: Upload Firefox Add-on Artifact
uses: actions/upload-artifact@v4
with:
name: release-firefox-addons
path: build/release/firefox-addons/*
if-no-files-found: error
build-linux-appimage:
if: needs.secret-scan.outputs.reuse_artifacts != 'true'
name: Build Linux AppImage
runs-on: ${{ matrix.runner }}
timeout-minutes: 60
needs: secret-scan
strategy:
fail-fast: false
matrix:
include:
- arch: x86_64
runner: ubuntu-22.04
tool_arch: x86_64
- arch: aarch64
runner: ubuntu-22.04-arm
tool_arch: aarch64
env:
APT_CACHE_DIR: /tmp/apt-cache
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
ref: ${{ inputs.revision || github.sha }}
fetch-depth: 1
- name: Fetch Ziran packages
uses: ./.github/actions/ziran-packages
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 22
- name: Cache Linux apt packages
uses: actions/cache@v4
with:
path: ${{ env.APT_CACHE_DIR }}
key: linux-apt-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('.github/apt/linux-packages.txt') }}
restore-keys: |
linux-apt-${{ runner.os }}-${{ runner.arch }}-
- name: Install Linux Dependencies
timeout-minutes: 15
run: .github/scripts/install-apt-packages.sh .github/apt/linux-packages.txt
- name: Install AppImage Tools
run: |
set -euo pipefail
mkdir -p "$HOME/.local/bin"
curl -L -o "$HOME/.local/bin/linuxdeploy" \
https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-${{ matrix.tool_arch }}.AppImage
curl -L -o "$HOME/.local/bin/linuxdeploy-plugin-appimage" \
https://github.com/linuxdeploy/linuxdeploy-plugin-appimage/releases/download/1-alpha-20250213-1/linuxdeploy-plugin-appimage-${{ matrix.tool_arch }}.AppImage
curl -L -o "$HOME/.local/bin/appimagetool" \
https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-${{ matrix.tool_arch }}.AppImage
chmod +x "$HOME/.local/bin/linuxdeploy" "$HOME/.local/bin/linuxdeploy-plugin-appimage" "$HOME/.local/bin/appimagetool"
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
- name: Build Linux AppImage
env:
APPIMAGE_EXTRACT_AND_RUN: "1"
RAY_RAYLIB_CONFIG: -DSUPPORT_SCREEN_CAPTURE=0 -DSUPPORT_COMPRESSION_API=0 -DSUPPORT_AUTOMATION_EVENTS=0 -DSUPPORT_CLIPBOARD_IMAGE=0 -DSUPPORT_FILEFORMAT_BMP=0 -DSUPPORT_FILEFORMAT_GIF=0 -DSUPPORT_FILEFORMAT_QOI=0 -DSUPPORT_FILEFORMAT_DDS=0 -DSUPPORT_FILEFORMAT_TTF=1
run: |
set -euo pipefail
RAY_SDL_INCLUDE_DIR="$(pkg-config --variable=includedir sdl2 | sed 's,/SDL2$,,')"
RAY_CFLAGS="$(pkg-config --cflags sdl2 libdrm gbm egl glesv2)"
RAY_LDLIBS="$(pkg-config --libs sdl2 libdrm gbm egl glesv2)"
RAY_SDL_LDLIBS="$(pkg-config --libs sdl2)"
export RAY_SDL_INCLUDE_DIR RAY_CFLAGS RAY_LDLIBS RAY_SDL_LDLIBS
make appimage
mkdir -p build/release/linux
find build/dist/linux -maxdepth 1 -type f -name '*.AppImage' -exec cp {} build/release/linux/ \;
test -n "$(find build/release/linux -type f -print -quit)"
- name: Smoke Test Linux AppImage
timeout-minutes: 5
env:
APPIMAGE_EXTRACT_AND_RUN: "1"
DISPLAY: ":99"
run: |
set -euo pipefail
appimage="$(find build/release/linux -maxdepth 1 -type f -name '*.AppImage' | head -n 1)"
chmod +x "$appimage"
Xvfb "$DISPLAY" -screen 0 800x600x24 >/tmp/inbe-xvfb.log 2>&1 &
xvfb_pid=$!
trap 'kill "$app_pid" "$xvfb_pid" >/dev/null 2>&1 || true' EXIT
sleep 2
"$appimage" >/tmp/inbe-appimage.log 2>&1 &
app_pid=$!
for _ in $(seq 1 30); do
if xwininfo -tree -root | grep -q 'Inner Breeze'; then
sleep 3
# A build without TrueType support draws a pixel font.
if grep -q 'Font is not supported' /tmp/inbe-appimage.log; then
echo "AppImage could not load its fonts"
cat /tmp/inbe-appimage.log || true
exit 1
fi
exit 0
fi
if ! kill -0 "$app_pid" >/dev/null 2>&1; then
echo "AppImage exited before opening a window"
cat /tmp/inbe-appimage.log || true
exit 1
fi
sleep 1
done
echo "AppImage did not open an X11 window within 30 seconds"
cat /tmp/inbe-appimage.log || true
exit 1
- name: Upload Linux AppImage Artifact
uses: actions/upload-artifact@v4
with:
name: release-linux-appimage-${{ matrix.arch }}
path: build/release/linux/*
if-no-files-found: error
build-linux-deb:
if: needs.secret-scan.outputs.reuse_artifacts != 'true'
name: Build Linux Deb
runs-on: ${{ matrix.runner }}
timeout-minutes: 60
needs: secret-scan
strategy:
fail-fast: false
matrix:
include:
- arch: amd64
runner: ubuntu-22.04
- arch: arm64
runner: ubuntu-22.04-arm
env:
APT_CACHE_DIR: /tmp/apt-cache
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
ref: ${{ inputs.revision || github.sha }}
fetch-depth: 1
- name: Fetch Ziran packages
uses: ./.github/actions/ziran-packages
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 22
- name: Cache Linux apt packages
uses: actions/cache@v4
with:
path: ${{ env.APT_CACHE_DIR }}
key: linux-apt-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('.github/apt/linux-packages.txt') }}
restore-keys: |
linux-apt-${{ runner.os }}-${{ runner.arch }}-
- name: Install Linux Dependencies
timeout-minutes: 15
run: .github/scripts/install-apt-packages.sh .github/apt/linux-packages.txt
- name: Build Debian Package
run: |
set -euo pipefail
make deb
mkdir -p build/release/linux
find build/dist/deb -maxdepth 1 -type f -name '*.deb' -exec cp {} build/release/linux/ \;
deb="$(find build/release/linux -maxdepth 1 -type f -name '*.deb' | head -n 1)"
test -n "$deb"
dpkg-deb --info "$deb"
dpkg-deb --contents "$deb" >/dev/null
- name: Upload Linux Deb Artifact
uses: actions/upload-artifact@v4
with:
name: release-linux-deb-${{ matrix.arch }}
path: build/release/linux/*
if-no-files-found: error
build-linux-rpm:
if: needs.secret-scan.outputs.reuse_artifacts != 'true'
name: Build Linux RPM
runs-on: ${{ matrix.runner }}
timeout-minutes: 60
needs: secret-scan
strategy:
fail-fast: false
matrix:
include:
- arch: x86_64
runner: ubuntu-22.04
- arch: aarch64
runner: ubuntu-22.04-arm
env:
APT_CACHE_DIR: /tmp/apt-cache
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
ref: ${{ inputs.revision || github.sha }}
fetch-depth: 1
- name: Fetch Ziran packages
uses: ./.github/actions/ziran-packages
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 22
- name: Cache Linux apt packages
uses: actions/cache@v4
with:
path: ${{ env.APT_CACHE_DIR }}
key: linux-apt-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('.github/apt/linux-packages.txt') }}
restore-keys: |
linux-apt-${{ runner.os }}-${{ runner.arch }}-
- name: Install Linux Dependencies
timeout-minutes: 15
run: .github/scripts/install-apt-packages.sh .github/apt/linux-packages.txt
- name: Build RPM Package
run: |
set -euo pipefail
make rpm
mkdir -p build/release/linux
find build/dist/rpm -maxdepth 1 -type f -name '*.rpm' -exec cp {} build/release/linux/ \;
rpm_package="$(find build/release/linux -maxdepth 1 -type f -name '*.rpm' | head -n 1)"
test -n "$rpm_package"
rpm -qip "$rpm_package"
rpm -qlp "$rpm_package" >/dev/null
- name: Upload Linux RPM Artifact
uses: actions/upload-artifact@v4
with:
name: release-linux-rpm-${{ matrix.arch }}
path: build/release/linux/*
if-no-files-found: error
build-linux-snap:
if: needs.secret-scan.outputs.reuse_artifacts != 'true'
name: Build Linux Snap
runs-on: ${{ matrix.runner }}
timeout-minutes: 60
needs: secret-scan
strategy:
fail-fast: false
matrix:
include:
- arch: x86_64
runner: ubuntu-22.04
- arch: aarch64
runner: ubuntu-22.04-arm
env:
APT_CACHE_DIR: /tmp/apt-cache
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
ref: ${{ inputs.revision || github.sha }}
fetch-depth: 1
- name: Fetch Ziran packages
uses: ./.github/actions/ziran-packages
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 22
- name: Cache Linux apt packages
uses: actions/cache@v4
with:
path: ${{ env.APT_CACHE_DIR }}
key: linux-apt-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('.github/apt/linux-packages.txt') }}
restore-keys: |
linux-apt-${{ runner.os }}-${{ runner.arch }}-
- name: Install Linux Dependencies
timeout-minutes: 15
run: .github/scripts/install-apt-packages.sh .github/apt/linux-packages.txt
- name: Build Snap Package
run: |
set -euo pipefail
make snap
mkdir -p build/release/linux
find build/dist/snap -maxdepth 1 -type f -name '*.snap' -exec cp {} build/release/linux/ \;
test -n "$(find build/release/linux -maxdepth 1 -type f -name '*.snap' -print -quit)"
- name: Upload Linux Snap Artifact
uses: actions/upload-artifact@v4
with:
name: release-linux-snap-${{ matrix.arch }}
path: build/release/linux/*
if-no-files-found: error
build-linux-flatpak:
if: needs.secret-scan.outputs.reuse_artifacts != 'true'
name: Build Linux Flatpak
runs-on: ${{ matrix.runner }}
timeout-minutes: 60
needs: secret-scan
strategy:
fail-fast: false
matrix:
include:
- arch: x86_64
runner: ubuntu-22.04
- arch: aarch64
runner: ubuntu-22.04-arm
env:
APT_CACHE_DIR: /tmp/apt-cache
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
ref: ${{ inputs.revision || github.sha }}
fetch-depth: 1
- name: Fetch Ziran packages
uses: ./.github/actions/ziran-packages
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 22
- name: Cache Linux apt packages
uses: actions/cache@v4
with:
path: ${{ env.APT_CACHE_DIR }}
key: linux-apt-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('.github/apt/linux-packages.txt') }}
restore-keys: |
linux-apt-${{ runner.os }}-${{ runner.arch }}-
- name: Install Linux Dependencies
timeout-minutes: 15
run: .github/scripts/install-apt-packages.sh .github/apt/linux-packages.txt
- name: Build Flatpak Bundle
run: |
set -euo pipefail
make flatpak
mkdir -p build/release/linux
find build/dist/flatpak -maxdepth 1 -type f -name '*.flatpak' -exec cp {} build/release/linux/ \;
test -n "$(find build/release/linux -maxdepth 1 -type f -name '*.flatpak' -print -quit)"
- name: Upload Linux Flatpak Artifact
uses: actions/upload-artifact@v4
with:
name: release-linux-flatpak-${{ matrix.arch }}
path: build/release/linux/*
if-no-files-found: error
build-windows:
if: needs.secret-scan.outputs.reuse_artifacts != 'true'
name: Build Windows
runs-on: ubuntu-latest
timeout-minutes: 60
needs: secret-scan
env:
APT_CACHE_DIR: /tmp/apt-cache
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
ref: ${{ inputs.revision || github.sha }}
fetch-depth: 1
- name: Fetch Ziran packages
uses: ./.github/actions/ziran-packages
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 22
- name: Cache Windows apt packages
uses: actions/cache@v4
with:
path: ${{ env.APT_CACHE_DIR }}
key: windows-apt-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('.github/apt/windows-packages.txt') }}
restore-keys: |
windows-apt-${{ runner.os }}-${{ runner.arch }}-
- name: Cache Windows vendor builds
uses: actions/cache@v4
with:
path: |
vendor-builds/windows
vendor-builds/sqlite
key: windows-vendor-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('Makefile', 'mk/**', '!mk/tests-*.mk', 'ziran.lock') }}
restore-keys: |
windows-vendor-${{ runner.os }}-${{ runner.arch }}-
- name: Install Windows Dependencies
timeout-minutes: 15
run: |
set -euo pipefail
.github/scripts/install-apt-packages.sh .github/apt/windows-packages.txt
if [ -x /usr/bin/x86_64-w64-mingw32-gcc-win32 ]; then
sudo update-alternatives --set x86_64-w64-mingw32-gcc /usr/bin/x86_64-w64-mingw32-gcc-win32
fi
- name: Build Windows ZIP and Setup
run: |
set -euo pipefail
make windows windows-setup
mkdir -p build/release/windows
find build/dist/windows -maxdepth 1 -type f \( -name '*.zip' -o -name '*-setup-*.exe' \) -exec cp {} build/release/windows/ \;
test -n "$(find build/release/windows -type f -print -quit)"
- name: Upload Windows Artifact
uses: actions/upload-artifact@v4
with:
name: release-windows
path: build/release/windows/*
if-no-files-found: error
build-android:
if: needs.secret-scan.outputs.reuse_artifacts != 'true'
name: Build Android
runs-on: ubuntu-latest
timeout-minutes: 60
needs: secret-scan
env:
APT_CACHE_DIR: /tmp/apt-cache
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
ref: ${{ inputs.revision || github.sha }}
fetch-depth: 1
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '21'
- name: Cache Android SDK packages
uses: actions/cache@v4
with:
path: |
${{ env.ANDROID_HOME }}/platforms/android-36
${{ env.ANDROID_HOME }}/build-tools/35.0.0
${{ env.ANDROID_HOME }}/ndk/28.2.13676358
${{ env.ANDROID_HOME }}/cmake/3.22.1
key: android-sdk-v2-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('.github/android-sdk-packages.txt') }}
restore-keys: |
android-sdk-v2-${{ runner.os }}-${{ runner.arch }}-
- name: Verify and install Android SDK components
timeout-minutes: 20
run: python3 .github/scripts/install-android-sdk.py
- name: Cache Android apt packages
uses: actions/cache@v4
with:
path: ${{ env.APT_CACHE_DIR }}
key: android-apt-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('.github/apt/android-packages.txt') }}
restore-keys: |
android-apt-${{ runner.os }}-${{ runner.arch }}-
- name: Install translation check dependency
timeout-minutes: 15
run: .github/scripts/install-apt-packages.sh .github/apt/android-packages.txt
- name: Fetch Ziran packages
uses: ./.github/actions/ziran-packages
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 22
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
- name: Cache Android native build
uses: actions/cache@v4
with:
path: |
droid/app/.cxx
droid/app/build/intermediates/cxx
key: android-native-v2-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('droid/app/src/main/cpp/CMakeLists.txt', 'droid/app/build.gradle', 'droid/build.gradle', 'src/**/*.zi', 'src/**/*.c', 'src/**/*.h', 'ziran.lock') }}
restore-keys: |
android-native-v2-${{ runner.os }}-${{ runner.arch }}-
- name: Prepare Android signing key
env:
KEYSTORE_BASE64: ${{ secrets.KEYSTORE_BASE64 }}
run: |
set -euo pipefail
mkdir -p ~/.android
echo "$KEYSTORE_BASE64" | base64 -d > ~/.android/inbe-release.keystore
- name: Prepare Firebase config
env:
GOOGLE_SERVICES_JSON_BASE64: ${{ secrets.GOOGLE_SERVICES_JSON_BASE64 }}
run: ./scripts/write-google-services-json.sh
- name: Copy Android Assets
run: ./scripts/copy-android-assets.sh
- name: Build Android APK and AAB
env:
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
run: |
set -euo pipefail
chmod +x droid/gradlew
./droid/gradlew -p droid assembleRelease assembleGplay \
-Pkeystore.path="$HOME/.android/inbe-release.keystore" \
-Pkeystore.alias="$KEY_ALIAS" \
-Pkeystore.password="$KEYSTORE_PASSWORD" \
--stacktrace
./droid/gradlew -p droid bundleGplay \
-Pkeystore.path="$HOME/.android/inbe-release.keystore" \
-Pkeystore.alias="$KEY_ALIAS" \
-Pkeystore.password="$KEYSTORE_PASSWORD" \
--stacktrace
make android-copy-release-apks
make android-copy-bundle
# F-Droid rebuilds the universal APK with -PfDroidBuild and copies
# this APK's signature onto it, so the two must match byte for byte.
./droid/gradlew -p droid assembleRelease -PfDroidBuild=true \
-Pkeystore.path="$HOME/.android/inbe-release.keystore" \
-Pkeystore.alias="$KEY_ALIAS" \
-Pkeystore.password="$KEYSTORE_PASSWORD" \
--stacktrace
make android-copy-fdroid-apk
- name: Preserve Android Native Crash Symbols
uses: actions/upload-artifact@v4
with:
name: android-native-symbols
path: droid/app/build/intermediates/native_debug_metadata/**/out/**/*.dbg
if-no-files-found: error
retention-days: 90
- name: Collect Android Release Files
run: |
set -euo pipefail
mkdir -p build/release/android
VERSION=$(python3 scripts/check-version.py --print-version)
if [ -z "$VERSION" ]; then
echo "Could not read APP_VERSION_STRING"
exit 1
fi
for apk in "build/android/inbe-$VERSION.apk" "build/android/inbe-$VERSION-gplay.apk" \
"build/android/inbe-$VERSION-fdroid.apk"; do
if [ ! -f "$apk" ]; then
echo "Missing universal APK: $apk"
exit 1
fi
cp "$apk" build/release/android/
done
for abi in arm64-v8a armeabi-v7a x86 x86_64; do
apk="build/android/inbe-$VERSION-$abi.apk"
test -f "$apk"
cp "$apk" build/release/android/
done
cp "build/android/inbe-$VERSION-gplay.aab" build/release/android/
- name: Upload Android Artifacts
uses: actions/upload-artifact@v4
with:
name: release-android
path: build/release/android/*
if-no-files-found: error
release:
if: >-
always() && !cancelled() && needs.secret-scan.result == 'success' &&
(needs.secret-scan.outputs.reuse_artifacts == 'true' ||
(!contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') &&
!contains(needs.*.result, 'skipped')))
name: Release
runs-on: ubuntu-latest
timeout-minutes: 60
needs:
- secret-scan
- test
- build-web
- build-chrome-extension
- build-firefox-addons
- build-linux-appimage
- build-linux-deb
- build-linux-rpm
- build-linux-snap
- build-linux-flatpak
- build-windows
- build-android
- verify-fdroid
outputs:
tag_pushed: ${{ steps.tag_version.outputs.tag_pushed }}
release_upload: ${{ steps.tag_version.outputs.release_upload }}
tag_name: ${{ steps.tag_version.outputs.tag_name }}
version: ${{ steps.tag_version.outputs.version }}
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
ref: ${{ inputs.revision || github.sha }}
fetch-depth: 0
- name: Download Release Artifacts
uses: actions/download-artifact@v4
with:
github-token: ${{ github.token }}
run-id: ${{ inputs.reuse_run || github.run_id }}
pattern: release-*
path: build/release
merge-multiple: true
- name: Verify Release Artifacts
run: |
set -euo pipefail
test -n "$(find build/release -type f -print -quit)"
VERSION=$(python3 scripts/check-version.py --print-version)
if [ -z "$VERSION" ]; then
echo "Could not read APP_VERSION_STRING"
exit 1
fi
missing=0
while IFS= read -r file; do
if [ ! -f "build/release/$file" ]; then
echo "::error::missing release artifact: $file"
missing=1
fi
done < <(scripts/list-expected-release-assets.sh "$VERSION")
exit "$missing"
- name: Require Phone Check or Explicit Owner Waiver for a New Version
run: |
set -euo pipefail
VERSION=$(python3 scripts/check-version.py --print-version)
if git rev-parse "v$VERSION" >/dev/null 2>&1; then
echo "v$VERSION is already tagged; no new version to check"
exit 0
fi
python3 scripts/check-phone-check.py "$VERSION"
- name: Create and Push Tag If Version Is New
id: tag_version
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -euo pipefail
VERSION=$(python3 scripts/check-version.py --print-version)
if [ -z "$VERSION" ]; then
echo "Could not read APP_VERSION_STRING"
exit 1
fi
TAG="v$VERSION"
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
echo "tag_name=$TAG" >> "$GITHUB_OUTPUT"
if git rev-parse "$TAG" >/dev/null 2>&1; then
if gh release view "$TAG" --repo "$GITHUB_REPOSITORY" >/dev/null 2>&1; then
gh release view "$TAG" --repo "$GITHUB_REPOSITORY" --json assets --jq '.assets[].name' | sort -u > existing-release-assets.txt
scripts/list-expected-release-assets.sh "$VERSION" | sort -u > expected-release-assets.txt
comm -23 expected-release-assets.txt existing-release-assets.txt > missing-release-assets.txt
if [ -s missing-release-assets.txt ]; then
echo "Tag $TAG exists; uploading missing GitHub release assets"
sed 's/^/missing asset: /' missing-release-assets.txt
echo "release_upload=true" >> "$GITHUB_OUTPUT"
else
echo "Tag $TAG and its GitHub release already have the expected assets, skipping release upload"
echo "release_upload=false" >> "$GITHUB_OUTPUT"
fi
echo "tag_pushed=false" >> "$GITHUB_OUTPUT"
else
echo "Tag $TAG exists but its GitHub release is missing; publishing release"
echo "tag_pushed=true" >> "$GITHUB_OUTPUT"
echo "release_upload=true" >> "$GITHUB_OUTPUT"
fi
else
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git tag -a "$TAG" -m "Release $VERSION"
git push origin "$TAG"
echo "tag_pushed=true" >> "$GITHUB_OUTPUT"
echo "release_upload=true" >> "$GITHUB_OUTPUT"
fi
- name: Generate Update Appcast
if: steps.tag_version.outputs.release_upload == 'true'
run: |
set -euo pipefail
VERSION='${{ steps.tag_version.outputs.version }}'
TAG="v$VERSION"
BASE="https://github.com/waozixyz/inbe/releases/download/$TAG"
WINZIP="$(find build/release -maxdepth 2 -name '*-windows.zip' -print -quit || true)"
channels=()
for appimage in build/release/inbe-linux-*.AppImage; do
[ -f "$appimage" ] || continue
case "$(basename "$appimage")" in
inbe-linux-x86_64.AppImage) channel=appimage-amd64 ;;
inbe-linux-aarch64.AppImage) channel=appimage-arm64 ;;
*) channel=appimage-$(basename "$appimage" .AppImage | sed 's/^inbe-linux-//') ;;
esac
channels+=("--channel" "$channel=$appimage")
done
[ -n "$WINZIP" ] && channels+=("--channel" "windows=$WINZIP")
for deb in build/release/*.deb; do
[ -f "$deb" ] || continue
arch="${deb##*_}"
arch="${arch%.deb}"
channels+=("--channel" "deb-$arch=$deb")
done
for rpm in build/release/*.rpm; do
[ -f "$rpm" ] || continue
arch="${rpm##*.}"
arch="${arch%.rpm}"
channels+=("--channel" "rpm-$arch=$rpm")
done
# Directly installed APKs update themselves from these channels;
# the Google Play and F-Droid builds update through their stores.
while IFS= read -r apk; do
abi="$(basename "$apk" .apk)"
abi="${abi#inbe-$VERSION}"
case "$abi" in
-gplay|-fdroid) continue ;;
"") channels+=("--channel" "android=$apk") ;;
*) channels+=("--channel" "android$abi=$apk") ;;
esac
done < <(find build/release -maxdepth 2 -name "inbe-$VERSION*.apk" | sort)
if [ ${#channels[@]} -eq 0 ]; then
echo "no release artifacts found for the appcast"
exit 1
fi
python3 scripts/make_appcast.py \
--version "$VERSION" \
--base-url "$BASE" \
--notes-url "https://github.com/waozixyz/inbe/releases/tag/$TAG" \
--changelog CHANGELOG.md \
--out build/release/appcast.json \
"${channels[@]}"
- name: Create GitHub Release
if: steps.tag_version.outputs.release_upload == 'true'
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.tag_version.outputs.tag_name }}
files: build/release/*
overwrite_files: true
generate_release_notes: true
draft: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
notify-waozi-site:
name: Notify Waozi devlog
runs-on: ubuntu-latest
needs: release
if: needs.release.outputs.release_upload == 'true'
steps:
- name: Trigger Waozi site rebuild
env:
WAOZI_SITE_DISPATCH_TOKEN: ${{ secrets.WAOZI_SITE_DISPATCH_TOKEN }}
VERSION: ${{ needs.release.outputs.version }}
run: |
set -euo pipefail
if [ -z "${WAOZI_SITE_DISPATCH_TOKEN:-}" ]; then
echo "::warning::WAOZI_SITE_DISPATCH_TOKEN is not configured; skipping Waozi devlog dispatch"
exit 0
fi
curl -fsS -X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $WAOZI_SITE_DISPATCH_TOKEN" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/waozixyz/waozi/dispatches \
-d "{\"event_type\":\"devlog\",\"client_payload\":{\"project\":\"inbe\",\"version\":\"$VERSION\"}}"
publish-itch:
name: Publish itch.io
runs-on: ubuntu-latest
timeout-minutes: 60
continue-on-error: true
needs:
- build-web
- release
if: always() && !cancelled() && needs.release.result == 'success' && needs.release.outputs.tag_pushed == 'true'
env:
BUTLER_API_KEY: ${{ secrets.ITCH_API_KEY }}
steps:
- name: Check itch.io Secret
run: |
set -euo pipefail
if [ -z "${BUTLER_API_KEY:-}" ]; then
echo "ITCH_API_KEY secret is required to publish itch.io"
exit 1
fi
- name: Checkout Repository
uses: actions/checkout@v4
with:
ref: ${{ inputs.revision || github.sha }}
- name: Download Release Artifacts
uses: actions/download-artifact@v4
with:
github-token: ${{ github.token }}
run-id: ${{ inputs.reuse_run || github.run_id }}
pattern: release-*
path: build/release
merge-multiple: true
- name: Install Butler
timeout-minutes: 15
run: |
set -euo pipefail
.github/scripts/install-apt-packages.sh .github/apt/empty-packages.txt unzip
curl -fsSL \
https://broth.itch.zone/butler/linux-amd64/LATEST/archive/default \
-o "$RUNNER_TEMP/butler.zip"
mkdir -p "$RUNNER_TEMP/butler"
unzip -q "$RUNNER_TEMP/butler.zip" -d "$RUNNER_TEMP/butler"
chmod +x "$RUNNER_TEMP/butler/butler"
echo "$RUNNER_TEMP/butler" >> "$GITHUB_PATH"
- name: Check Butler
run: |
set -euo pipefail
butler version
- name: Publish Release Builds to itch.io
run: |
set -euo pipefail
VERSION="${{ needs.release.outputs.version }}"
web_zip="build/release/inbe-web.zip"
android_apk="build/release/inbe-$VERSION.apk"
windows_zip="build/release/inbe-windows.zip"
linux_appimage="build/release/inbe-linux-x86_64.AppImage"
test -f "$web_zip"
test -f "$android_apk"
test -f "$windows_zip"
test -f "$linux_appimage"
mkdir -p build/itch/inbe-web
unzip -q "$web_zip" -d build/itch/inbe-web
butler_push() {
local target="$1"
local channel="$2"
local attempt
local log_file
log_file="$(mktemp)"
for attempt in 1 2 3 4 5 6; do
if butler push "$target" "waozi/inbe:$channel" --userversion "$VERSION" 2>&1 | tee "$log_file"; then
rm -f "$log_file"
return 0
fi
if ! grep -q "latest build is still processing" "$log_file"; then
rm -f "$log_file"
return 1
fi
echo "itch.io channel $channel is still processing; retrying in 60s ($attempt/6)"
sleep 60
done
rm -f "$log_file"
echo "itch.io channel $channel was still processing after retries"
return 1
}
butler_push build/itch/inbe-web html5
butler_push "$android_apk" android
butler_push "$windows_zip" windows
butler_push "$linux_appimage" linux
publish-google-play:
name: Publish Google Play Production
runs-on: ubuntu-latest
timeout-minutes: 60
continue-on-error: true
needs:
- build-android
- release
if: always() && !cancelled() && needs.release.result == 'success' && needs.release.outputs.tag_pushed == 'true'
steps:
- name: Check Google Play Secret
env:
PLAY_STORE_JSON_KEY: ${{ secrets.PLAY_STORE_JSON_KEY }}
run: |
set -euo pipefail
if [ -z "${PLAY_STORE_JSON_KEY:-}" ]; then
echo "PLAY_STORE_JSON_KEY secret is required to publish Google Play"
exit 1
fi
- name: Download Android Release Artifact
uses: actions/download-artifact@v4
with:
github-token: ${{ github.token }}
run-id: ${{ inputs.reuse_run || github.run_id }}
name: release-android
path: build/release/android
- name: Publish AAB to Google Play Production
uses: r0adkll/upload-google-play@v1
with:
serviceAccountJsonPlainText: ${{ secrets.PLAY_STORE_JSON_KEY }}
packageName: xyz.waozi.inbe
releaseFiles: build/release/android/inbe-${{ needs.release.outputs.version }}-gplay.aab
track: production
status: completed
publish-amazon:
name: Publish Amazon Appstore
runs-on: ubuntu-latest
timeout-minutes: 60
continue-on-error: true
needs:
- build-android
- release
if: always() && !cancelled() && needs.release.result == 'success' && needs.release.outputs.tag_pushed == 'true'
env:
AMAZON_CLIENT_ID: ${{ secrets.AMAZON_CLIENT_ID }}
AMAZON_CLIENT_SECRET: ${{ secrets.AMAZON_CLIENT_SECRET }}
AMAZON_APP_ID: ${{ secrets.AMAZON_APP_ID }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ inputs.revision || github.sha }}
- name: Check Amazon Appstore Secrets
id: amazon_secrets
run: |
set -euo pipefail
for name in AMAZON_CLIENT_ID AMAZON_CLIENT_SECRET AMAZON_APP_ID; do
if [ -z "${!name:-}" ]; then
echo "::warning::$name secret is not configured; skipping Amazon Appstore publish"
echo "configured=false" >> "$GITHUB_OUTPUT"
exit 0
fi
done
echo "configured=true" >> "$GITHUB_OUTPUT"
- name: Download Android Release Artifact
if: steps.amazon_secrets.outputs.configured == 'true'
uses: actions/download-artifact@v4
with:
github-token: ${{ github.token }}
run-id: ${{ inputs.reuse_run || github.run_id }}
name: release-android
path: build/release/android
- name: Set up Node
if: steps.amazon_secrets.outputs.configured == 'true'
uses: actions/setup-node@v4
with:
node-version: '24'
- name: Upload APK to Amazon Appstore
if: steps.amazon_secrets.outputs.configured == 'true'
env:
AMAZON_RELEASE_FILE: build/release/android/inbe-${{ needs.release.outputs.version }}.apk
run: |
set -euo pipefail
if ! node scripts/upload-amazon-appstore.mjs; then
echo "::warning::Amazon Appstore publish failed; release artifacts were still created"
fi
publish-chrome-web-store:
name: Publish Chrome Web Store
runs-on: ubuntu-latest
timeout-minutes: 60
continue-on-error: true
needs:
- build-chrome-extension
- release
if: always() && !cancelled() && needs.release.result == 'success' && needs.release.outputs.tag_pushed == 'true'
steps:
- name: Check Chrome Web Store Secrets
id: chrome_secrets
env:
CHROME_CLIENT_ID: ${{ secrets.CHROME_CLIENT_ID }}
CHROME_CLIENT_SECRET: ${{ secrets.CHROME_CLIENT_SECRET }}
CHROME_REFRESH_TOKEN: ${{ secrets.CHROME_REFRESH_TOKEN }}
run: |
set -euo pipefail
if [ -z "${CHROME_CLIENT_ID:-}" ]; then
echo "::warning::CHROME_CLIENT_ID secret is not configured; skipping Chrome Web Store publish"
echo "configured=false" >> "$GITHUB_OUTPUT"
exit 0
fi
if [ -z "${CHROME_CLIENT_SECRET:-}" ]; then
echo "::warning::CHROME_CLIENT_SECRET secret is not configured; skipping Chrome Web Store publish"
echo "configured=false" >> "$GITHUB_OUTPUT"
exit 0
fi
if [ -z "${CHROME_REFRESH_TOKEN:-}" ]; then
echo "::warning::CHROME_REFRESH_TOKEN secret is not configured; skipping Chrome Web Store publish"
echo "configured=false" >> "$GITHUB_OUTPUT"
exit 0
fi
echo "configured=true" >> "$GITHUB_OUTPUT"
- name: Download Chrome Extension Artifact
if: steps.chrome_secrets.outputs.configured == 'true'
uses: actions/download-artifact@v4
with:
github-token: ${{ github.token }}
run-id: ${{ inputs.reuse_run || github.run_id }}
name: release-chrome-web-store
path: build/release/chrome-web-store
- name: Publish Chrome Extension
if: steps.chrome_secrets.outputs.configured == 'true'
env:
CHROME_CLIENT_ID: ${{ secrets.CHROME_CLIENT_ID }}
CHROME_CLIENT_SECRET: ${{ secrets.CHROME_CLIENT_SECRET }}
CHROME_REFRESH_TOKEN: ${{ secrets.CHROME_REFRESH_TOKEN }}
CHROME_EXTENSION_ID: lballhghblaenelehneigekpofgcaifa
CHROME_EXTENSION_ZIP: build/release/chrome-web-store/inbe-chrome-web-store.zip
run: |
set -euo pipefail
token_response_file="$(mktemp)"
token_status="$(curl --silent --show-error \
--request POST \
--data-urlencode "client_id=${CHROME_CLIENT_ID}" \
--data-urlencode "client_secret=${CHROME_CLIENT_SECRET}" \
--data-urlencode "refresh_token=${CHROME_REFRESH_TOKEN}" \
--data-urlencode "grant_type=refresh_token" \
--output "$token_response_file" \
--write-out "%{http_code}" \
https://oauth2.googleapis.com/token)"
token_response="$(cat "$token_response_file")"
rm -f "$token_response_file"
if [ "$token_status" -lt 200 ] || [ "$token_status" -ge 300 ]; then
echo "::error::Chrome Web Store token request failed with HTTP $token_status: $token_response"
exit 1
fi
access_token="$(python3 -c 'import json, sys; print(json.load(sys.stdin)["access_token"])' <<< "$token_response")"
upload_response_file="$(mktemp)"
upload_status="$(curl --silent --show-error \
--request PUT \
--header "Authorization: Bearer ${access_token}" \
--header "x-goog-api-version: 2" \
--upload-file "${CHROME_EXTENSION_ZIP}" \
--output "$upload_response_file" \
--write-out "%{http_code}" \
"https://www.googleapis.com/upload/chromewebstore/v1.1/items/${CHROME_EXTENSION_ID}")"
upload_response="$(cat "$upload_response_file")"
rm -f "$upload_response_file"
if [ "$upload_status" -lt 200 ] || [ "$upload_status" -ge 300 ]; then
echo "::error::Chrome Web Store upload failed with HTTP $upload_status: $upload_response"
exit 1
fi
python3 - "$upload_response" <<'PY'
import json
import sys
response = json.loads(sys.argv[1])
if response.get("uploadState") != "SUCCESS":
print(json.dumps(response, indent=2), file=sys.stderr)
print("::error::Chrome Web Store upload was not accepted")
raise SystemExit(1)
PY
publish_response_file="$(mktemp)"
publish_status="$(curl --silent --show-error \
--request POST \
--header "Authorization: Bearer ${access_token}" \
--header "x-goog-api-version: 2" \
--output "$publish_response_file" \
--write-out "%{http_code}" \
"https://www.googleapis.com/chromewebstore/v1.1/items/${CHROME_EXTENSION_ID}/publish")"
publish_response="$(cat "$publish_response_file")"
rm -f "$publish_response_file"
if [ "$publish_status" -lt 200 ] || [ "$publish_status" -ge 300 ]; then
echo "::error::Chrome Web Store publish failed with HTTP $publish_status: $publish_response"
exit 1
fi
python3 - "$publish_response" <<'PY'
import json
import sys
response = json.loads(sys.argv[1])
if "OK" not in response.get("status", []):
print(json.dumps(response, indent=2), file=sys.stderr)
print("::error::Chrome Web Store publish was not accepted")
raise SystemExit(1)
PY
publish-firefox-addons:
name: Publish Firefox Add-ons
runs-on: ubuntu-latest
timeout-minutes: 60
continue-on-error: true
needs:
- build-firefox-addons
- release
if: always() && !cancelled() && needs.release.result == 'success' && needs.release.outputs.tag_pushed == 'true'
steps:
- name: Check Firefox Add-ons Secrets
id: firefox_secrets
env:
AMO_JWT_ISSUER: ${{ secrets.AMO_JWT_ISSUER }}
AMO_JWT_SECRET: ${{ secrets.AMO_JWT_SECRET }}
run: |
set -euo pipefail
if [ -z "${AMO_JWT_ISSUER:-}" ]; then
echo "::warning::AMO_JWT_ISSUER secret is not configured; skipping Firefox Add-ons publish"
echo "configured=false" >> "$GITHUB_OUTPUT"
exit 0
fi
if [ -z "${AMO_JWT_SECRET:-}" ]; then
echo "::warning::AMO_JWT_SECRET secret is not configured; skipping Firefox Add-ons publish"
echo "configured=false" >> "$GITHUB_OUTPUT"
exit 0
fi
echo "configured=true" >> "$GITHUB_OUTPUT"
- name: Download Firefox Add-on Artifact
if: steps.firefox_secrets.outputs.configured == 'true'
uses: actions/download-artifact@v4
with:
github-token: ${{ github.token }}
run-id: ${{ inputs.reuse_run || github.run_id }}
name: release-firefox-addons
path: build/release/firefox-addons
- name: Set up Node
if: steps.firefox_secrets.outputs.configured == 'true'
uses: actions/setup-node@v4
with:
node-version: '24'
- name: Publish Firefox Add-on
if: steps.firefox_secrets.outputs.configured == 'true'
env:
AMO_JWT_ISSUER: ${{ secrets.AMO_JWT_ISSUER }}
AMO_JWT_SECRET: ${{ secrets.AMO_JWT_SECRET }}
FIREFOX_ADDON_ZIP: build/release/firefox-addons/inbe-firefox-addons.zip
run: |
set -euo pipefail
test -f "$FIREFOX_ADDON_ZIP"
mkdir -p build/firefox-addons/source build/firefox-addons/signed
unzip -q "$FIREFOX_ADDON_ZIP" -d build/firefox-addons/source
if ! npx --yes web-ext sign \
--source-dir build/firefox-addons/source \
--artifacts-dir build/firefox-addons/signed \
--channel listed \
--api-key "$AMO_JWT_ISSUER" \
--api-secret "$AMO_JWT_SECRET"; then
echo "::warning::Firefox Add-ons publish failed; release artifacts were still created"
fi
publish-winget:
name: Publish winget manifest
runs-on: ubuntu-latest
timeout-minutes: 15
continue-on-error: true
needs: release
if: always() && !cancelled() && needs.release.result == 'success' && needs.release.outputs.tag_pushed == 'true'
env:
WINGET_TOKEN: ${{ secrets.WINGET_TOKEN }}
steps:
- name: Check winget Token
run: |
if [ -z "${WINGET_TOKEN:-}" ]; then
echo "WINGET_TOKEN secret not set; skipping winget manifest update"
exit 0
fi
- name: Download wingetcreate
if: env.WINGET_TOKEN != ''
run: |
set -euo pipefail
curl -fsSL \
https://github.com/russellbanks/wingetcreate/releases/latest/download/wingetcreate-linux-x64.tar.gz \
-o /tmp/wingetcreate.tar.gz
tar -xzf /tmp/wingetcreate.tar.gz -C "$HOME"
chmod +x "$HOME/wingetcreate"
- name: Submit winget manifest update
if: env.WINGET_TOKEN != ''
run: |
set -euo pipefail
VERSION='${{ needs.release.outputs.version }}'
SETUP_URL="https://github.com/waozixyz/inbe/releases/download/v$VERSION/inbe-windows-setup-$VERSION.exe"
if ! curl -fsSL -o /dev/null "$SETUP_URL"; then
echo "::warning::setup exe not published yet; skipping winget update"
exit 0
fi
"$HOME/wingetcreate" update xyz.waozi.inbe \
--version "$VERSION" \
--urls "$SETUP_URL#x64" \
--submit \
--token "$WINGET_TOKEN"