From a260969138ac00ad3f43340fd50177fcb95804c5 Mon Sep 17 00:00:00 2001 From: Steffen Becker Date: Sat, 12 Sep 2026 00:51:08 +0200 Subject: [PATCH] ci: a version tag publishes the built dist/ as a release archive Serving the app then needs no Node toolchain: download the archive from the release, unzip, point a web server at the folder it unpacks as. The notes come from the changelog section for that version. The tag is held against package.json first, whose version the build stamps into the app. --- .github/workflows/release.yml | 41 +++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..de5fe4e --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,41 @@ +# Builds dist/ on a version tag and attaches it to a GitHub release, so serving +# the app needs no Node toolchain: unzip, point a web server at the folder. +name: Release + +on: + push: + tags: ['v[0-9]+.[0-9]+.[0-9]+'] + +permissions: + contents: write + +jobs: + release: + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 24 + cache: npm + # The build stamps package.json's version into the app, so a tag that + # disagrees would publish an archive naming a version it isn't. + - run: test "v$(node -p 'require("./package.json").version')" = "$GITHUB_REF_NAME" || { echo "$GITHUB_REF_NAME does not match package.json"; exit 1; } + - run: npm ci + - run: npm run build + # The archive unpacks as edentext-/, ready to serve as a web root. + - run: | + mv dist "edentext-$GITHUB_REF_NAME" + zip -qr "edentext-$GITHUB_REF_NAME.zip" "edentext-$GITHUB_REF_NAME" + # This version's changelog section carries the notes; commit subjects + # stand in where it has none. + - env: + GH_TOKEN: ${{ github.token }} + run: | + awk -v h="## [${GITHUB_REF_NAME#v}]" 'index($0, h) == 1 { p = 1; next } p && /^## \[/ { exit } p' CHANGELOG.md > notes.md + if [ -s notes.md ]; then + gh release create "$GITHUB_REF_NAME" "edentext-$GITHUB_REF_NAME.zip" --notes-file notes.md + else + gh release create "$GITHUB_REF_NAME" "edentext-$GITHUB_REF_NAME.zip" --generate-notes + fi