mirror of
https://github.com/Zakkaus/doona.git
synced 2026-12-06 08:02:04 +00:00
The v0.1.0-beta.13 release spent over 31 minutes in one serial `playwright test` run (Chromium, subpath, WebKit and WebKit PWA). main's Check already runs exactly those projects in 9 shards on the commit a release tag points at, so the release repeated it. A new `verified` job requires Check (push event) to have concluded success for the tagged commit, waiting for it if it is still running and failing otherwise. `build` needs it and drops the e2e install and test steps; pnpm check, build, check:size, packaging, the honk bundle and the release job are unchanged. Expected release time: about 3 to 4 minutes once Check is green. Net: +23/−4. Checks: actionlint.
186 lines
8.9 KiB
YAML
186 lines
8.9 KiB
YAML
name: Release
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'v*'
|
|
|
|
permissions: {}
|
|
|
|
env:
|
|
NFPM_VERSION: 2.47.0
|
|
NFPM_SHA256: 0660ca602b2d2d2ae4781a06c692b3eeb9d437ffea05b831d76e41f4a3188783
|
|
|
|
jobs:
|
|
# A tag points at a commit that main's Check already ran the browser suite on, so the release waits for that run
|
|
# instead of repeating the suite serially.
|
|
verified:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 40
|
|
permissions:
|
|
actions: read
|
|
env:
|
|
GH_TOKEN: ${{ github.token }}
|
|
GH_REPO: ${{ github.repository }}
|
|
steps:
|
|
- name: Require a successful Check run for this commit
|
|
run: |
|
|
runs="repos/${GITHUB_REPOSITORY}/actions/workflows/check.yml/runs?head_sha=${GITHUB_SHA}&event=push&per_page=1"
|
|
id=$(gh api "$runs" --jq '.workflow_runs[0].id // empty')
|
|
[ -n "$id" ] || { echo "::error::Check has no push run for ${GITHUB_SHA}; tag a commit that is on main." >&2; exit 1; }
|
|
if [ "$(gh run view "$id" --json status --jq .status)" != completed ]; then
|
|
gh run watch "$id" --interval 30 > /dev/null
|
|
fi
|
|
conclusion=$(gh run view "$id" --json conclusion --jq .conclusion)
|
|
[ "$conclusion" = success ] || { echo "::error::Check run $id for ${GITHUB_SHA} ended as '$conclusion'." >&2; exit 1; }
|
|
|
|
build:
|
|
needs: [verified]
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
outputs:
|
|
VERSION: ${{ steps.version.outputs.VERSION }}
|
|
PRERELEASE: ${{ steps.version.outputs.PRERELEASE }}
|
|
ARCH_PRERELEASE: ${{ steps.version.outputs.ARCH_PRERELEASE }}
|
|
NPM: ${{ steps.version.outputs.NPM }}
|
|
PACKAGE_RELEASE: ${{ steps.version.outputs.PACKAGE_RELEASE }}
|
|
steps:
|
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
with:
|
|
fetch-depth: 0
|
|
- uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413 # v6.1.0
|
|
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
|
|
with:
|
|
node-version: 22
|
|
cache: pnpm
|
|
# The tag names the version; package.json has to agree before anything is built.
|
|
- name: Check the tag against package.json
|
|
id: version
|
|
run: |
|
|
eval "$(tools/version.sh "${GITHUB_REF_NAME}")"
|
|
declared=$(node -p 'require("./package.json").version')
|
|
[ "$NPM" = "$declared" ] || { echo "tag ${GITHUB_REF_NAME} is version $NPM, package.json says $declared" >&2; exit 1; }
|
|
{
|
|
echo "VERSION=$VERSION"
|
|
echo "PRERELEASE=$PRERELEASE"
|
|
echo "ARCH_PRERELEASE=$ARCH_PRERELEASE"
|
|
echo "NPM=$NPM"
|
|
echo "PACKAGE_RELEASE=$PACKAGE_RELEASE"
|
|
} | tee -a "$GITHUB_ENV" >> "$GITHUB_OUTPUT"
|
|
- run: pnpm install --frozen-lockfile
|
|
- run: pnpm check
|
|
- run: pnpm build
|
|
- run: pnpm check:size
|
|
- run: tools/package.sh --git-version
|
|
- name: Install nfpm
|
|
run: |
|
|
curl -fsSL --retry 3 -o "$RUNNER_TEMP/nfpm.tar.gz" \
|
|
"https://github.com/goreleaser/nfpm/releases/download/v${NFPM_VERSION}/nfpm_${NFPM_VERSION}_Linux_x86_64.tar.gz"
|
|
echo "${NFPM_SHA256} $RUNNER_TEMP/nfpm.tar.gz" | sha256sum -c -
|
|
tar -xzf "$RUNNER_TEMP/nfpm.tar.gz" -C "$RUNNER_TEMP" nfpm
|
|
echo "$RUNNER_TEMP" >> "$GITHUB_PATH"
|
|
# SOURCE_DATE_EPOCH makes the packages reproducible. Alpine is served by install/alpine/APKBUILD instead:
|
|
# nfpm's apk output carries a directory mode apk-tools rejects.
|
|
- name: Build the distribution packages
|
|
run: |
|
|
SOURCE_DATE_EPOCH=$(git log -1 --format=%ct)
|
|
export SOURCE_DATE_EPOCH
|
|
program=build/stage/doona/usr/share/doona
|
|
fonts=build/stage/doona-fonts/usr/share/doona
|
|
mkdir -p "$program" "$fonts"
|
|
tar -xzf "release/doona-${NPM}.tar.gz" -C "$program"
|
|
tar -xzf "release/doona-fonts-${NPM}.tar.gz" -C "$fonts"
|
|
doc=build/stage/doona/usr/share/doc/doona
|
|
mkdir -p "$doc" build/stage/doona-fonts/usr/share/doc/doona
|
|
mv "$program"/LICENSE "$program"/LICENSES "$program"/NOTICE "$program"/THIRD-PARTY-NOTICES.txt \
|
|
"$program"/README.md "$program"/CHANGELOG.md "$doc"/
|
|
# rpm takes the documentation files one by one from doona.yaml; a file it does not list would be missing.
|
|
(cd "$doc" && find . -type f) | sort | while read -r file; do
|
|
grep -qxF " dst: /usr/share/doc/doona/${file#./}" install/nfpm/doona.yaml ||
|
|
{ echo "install/nfpm/doona.yaml does not list ${file#./} for rpm" >&2; exit 1; }
|
|
done
|
|
cp "$fonts"/fonts/OFL.txt build/stage/doona-fonts/usr/share/doc/doona/OFL.txt
|
|
# Debian's archive has an unrelated doona, so only the deb carries the -web suffix (see doona.yaml).
|
|
for packager in deb rpm ipk archlinux; do
|
|
if [ "$packager" = deb ]; then export PACKAGE_SUFFIX=-web; else export PACKAGE_SUFFIX=; fi
|
|
for config in install/nfpm/doona.yaml install/nfpm/doona-fonts.yaml; do
|
|
if [ "$packager" = archlinux ]; then
|
|
# nfpm 2.47 needs an explicit default epoch to retain Arch's prerelease in .PKGINFO.
|
|
arch_config="$RUNNER_TEMP/$(basename "$config")"
|
|
sed "/^version_schema: semver$/a epoch: '0'" "$config" > "$arch_config"
|
|
PRERELEASE="$ARCH_PRERELEASE" nfpm package --config "$arch_config" --packager "$packager" --target release/
|
|
else
|
|
nfpm package --config "$config" --packager "$packager" --target release/
|
|
fi
|
|
done
|
|
done
|
|
# Keep upstream SemVer in asset names; package metadata retains each format's own version.
|
|
- name: Sum every asset
|
|
run: |
|
|
cd release
|
|
if [ -n "$PRERELEASE" ]; then
|
|
for name in doona doona-fonts; do
|
|
deb="doona-web${name#doona}"
|
|
mv "${deb}_${VERSION}~${PRERELEASE}-${PACKAGE_RELEASE}_all.deb" "${deb}_${NPM}-${PACKAGE_RELEASE}_all.deb"
|
|
mv "${name}-${VERSION}~${PRERELEASE}-${PACKAGE_RELEASE}.noarch.rpm" "${name}-${NPM}-${PACKAGE_RELEASE}.noarch.rpm"
|
|
mv "${name}_${VERSION}~${PRERELEASE}-${PACKAGE_RELEASE}_all.ipk" "${name}_${NPM}-${PACKAGE_RELEASE}_all.ipk"
|
|
done
|
|
fi
|
|
set -- "doona-${NPM}.tar.gz" "doona-fonts-${NPM}.tar.gz"
|
|
for name in doona doona-fonts; do
|
|
set -- "$@" "doona-web${name#doona}_${NPM}-${PACKAGE_RELEASE}_all.deb" "${name}-${NPM}-${PACKAGE_RELEASE}.noarch.rpm" \
|
|
"${name}_${NPM}-${PACKAGE_RELEASE}_all.ipk" "${name}-${VERSION}${ARCH_PRERELEASE}-${PACKAGE_RELEASE}-any.pkg.tar.zst"
|
|
done
|
|
sha256sum "$@" > SHA256SUMS
|
|
# Temporary: honk has no release with the native API yet, so every doona release carries the honk debug builds of the
|
|
# tag pinned in tools/honk-pin.txt, the source archive of their commit and a note naming it. fetch-honk.mjs reads that
|
|
# tag's own release and fails unless its body, target and source tag name the pinned tag and commit. Remove this step,
|
|
# that file and the three honk lines in release's `files` once honk ships one.
|
|
- name: Bundle the honk-core debug builds
|
|
env:
|
|
GH_TOKEN: ${{ github.token }}
|
|
run: |
|
|
node tools/fetch-honk.mjs release
|
|
cd release
|
|
sha256sum honk-core-debug-*.tar.gz honk-source-*.tar.gz HONK-SOURCE.txt >> SHA256SUMS
|
|
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
|
with:
|
|
name: release-assets
|
|
path: release/
|
|
if-no-files-found: error
|
|
retention-days: 1
|
|
|
|
release:
|
|
needs: [build]
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: write
|
|
env:
|
|
VERSION: ${{ needs.build.outputs.VERSION }}
|
|
PRERELEASE: ${{ needs.build.outputs.PRERELEASE }}
|
|
ARCH_PRERELEASE: ${{ needs.build.outputs.ARCH_PRERELEASE }}
|
|
NPM: ${{ needs.build.outputs.NPM }}
|
|
PACKAGE_RELEASE: ${{ needs.build.outputs.PACKAGE_RELEASE }}
|
|
steps:
|
|
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
|
|
with:
|
|
name: release-assets
|
|
path: release/
|
|
- uses: softprops/action-gh-release@efb35369e0ad2afab669f228072c1b0d510eae64 # v3.0.3
|
|
with:
|
|
draft: true
|
|
prerelease: ${{ env.PRERELEASE != '' }}
|
|
fail_on_unmatched_files: true
|
|
# The last three lines belong to the temporary honk-core step in the build job.
|
|
files: |
|
|
release/*-${{ env.NPM }}.tar.gz
|
|
release/*_${{ env.NPM }}-${{ env.PACKAGE_RELEASE }}_all.deb
|
|
release/*-${{ env.NPM }}-${{ env.PACKAGE_RELEASE }}.noarch.rpm
|
|
release/*_${{ env.NPM }}-${{ env.PACKAGE_RELEASE }}_all.ipk
|
|
release/*-${{ env.VERSION }}${{ env.ARCH_PRERELEASE }}-${{ env.PACKAGE_RELEASE }}-any.pkg.tar.zst
|
|
release/SHA256SUMS
|
|
release/honk-core-debug-*.tar.gz
|
|
release/honk-source-*.tar.gz
|
|
release/HONK-SOURCE.txt
|