@@ -29,6 +29,10 @@ name: five hosts
2929on :
3030 push :
3131 branches : [main]
32+ # ⚠️ A TAG BUILDS THE SAME FIVE LEGS AND PUBLISHES THEM. The matrix is not
33+ # duplicated into a separate release workflow: a release built by different
34+ # steps from the ones that were tested is a release nobody tested.
35+ tags : ['[0-9]+.[0-9]+.[0-9]+*']
3236 pull_request :
3337 workflow_dispatch :
3438
4448 name : qemu-system-x86_64 on ${{ matrix.label }}
4549 runs-on : ${{ matrix.os }}
4650 timeout-minutes : 90
51+ permissions :
52+ contents : write # the tag path attaches archives to the release
4753 strategy :
4854 fail-fast : false
4955 matrix :
@@ -521,8 +527,52 @@ jobs:
521527 du -sh out/* 2>/dev/null | sort -rh | head -10
522528 du -sh out/share/* 2>/dev/null | sort -rh | head -10
523529
530+ # ── The publishable archive ────────────────────────────────────────
531+ #
532+ # ⚠️ NAMED FOR THE INDEX, NOT FOR THIS REPOSITORY. `xim`'s descriptor
533+ # builds the URL from `${version}` and a platform/arch pair, so the file
534+ # name has to be derivable from those alone — `qemu-x86-<ver>-<host>.<ext>`
535+ # with the same `linux`/`darwin`/`win32` and `x64`/`arm64` spellings
536+ # `qemu-riscv` uses. A name only this workflow understands would force the
537+ # descriptor to special-case it.
538+ #
539+ # The sidecar carries the same hash the descriptor will quote, computed
540+ # here from the archive that is actually uploaded rather than recomputed
541+ # later from a download.
542+ - name : Pack the archive
543+ shell : bash
544+ run : |
545+ set -euo pipefail
546+ V="${GITHUB_REF_NAME}"
547+ case "$V" in refs/*|main) V="${QEMU_VERSION}" ;; esac
548+ NAME="qemu-x86-${V}-${{ matrix.label }}"
549+ mkdir -p dist
550+ if [ "$RUNNER_OS" = "Windows" ]; then
551+ ( cd out && 7z a -tzip "../dist/${NAME}.zip" . > /dev/null )
552+ F="dist/${NAME}.zip"
553+ else
554+ tar czf "dist/${NAME}.tar.gz" -C out .
555+ F="dist/${NAME}.tar.gz"
556+ fi
557+ # ⚠️ `shasum -a 256` rather than `sha256sum`: macOS has the former and
558+ # not the latter, and a fallback chain here is one line against a leg
559+ # that would otherwise fail after a 40-minute build.
560+ if command -v sha256sum > /dev/null; then sha256sum "$F" > "$F.sha256";
561+ else shasum -a 256 "$F" > "$F.sha256"; fi
562+ ls -l dist/
563+ cat "$F.sha256"
564+
524565 - uses : actions/upload-artifact@v4
525566 with :
526- name : qemu-system-x86_64 -${{ matrix.label }}
527- path : out
567+ name : qemu-x86 -${{ matrix.label }}
568+ path : dist
528569 retention-days : 14
570+
571+ # ⚠️ ONLY ON A TAG, AND ONLY AFTER THE CHECKS ABOVE. A leg that built but
572+ # did not produce a runnable emulator must not reach a release.
573+ - name : Publish to the release
574+ if : startsWith(github.ref, 'refs/tags/')
575+ uses : softprops/action-gh-release@v2
576+ with :
577+ files : dist/*
578+ fail_on_unmatched_files : true
0 commit comments