Merge pull request #1248 from OffbandMesh/feat/1247-macos-manual
feat(#1247): manual macOS build that attaches to an existing releasepull/1254/head
commit
b2482e0e89
@ -0,0 +1,26 @@
|
||||
#!/usr/bin/env bash
|
||||
# Decides whether a manual macOS build of HEAD may be attached to the release
|
||||
# for <tag> (#1247). The zip has to be the tagged app, so only CI and docs may
|
||||
# differ between the tag and HEAD. Anything else is refused, naming the files.
|
||||
#
|
||||
# usage: macos-manual-check.sh <tag>
|
||||
set -eu
|
||||
|
||||
tag="${1:?tag}"
|
||||
|
||||
if ! printf '%s\n' "${tag}" | grep -Eqx 'v[0-9]+\.[0-9]+\.[0-9]+(-rc\.[0-9]+)?'; then
|
||||
echo "::error::'${tag}' is not a release tag (vX.Y.Z or vX.Y.Z-rc.N)."
|
||||
exit 1
|
||||
fi
|
||||
if ! git rev-parse -q --verify "refs/tags/${tag}^{commit}" > /dev/null; then
|
||||
echo "::error::Tag ${tag} does not exist in this checkout."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
changed="$(git diff --name-only "refs/tags/${tag}" HEAD -- . ':!.github' ':!docs')"
|
||||
if [ -n "${changed}" ]; then
|
||||
echo "::error::Files outside .github/ and docs/ changed since ${tag}, so this would not build the tagged app:"
|
||||
printf '%s\n' "${changed}"
|
||||
exit 1
|
||||
fi
|
||||
echo "Only CI and docs differ from ${tag}: this builds the tagged app."
|
||||
@ -0,0 +1,74 @@
|
||||
name: macOS release (manual)
|
||||
|
||||
# Builds, signs and notarizes the macOS app from main and attaches it to an
|
||||
# existing release (#1247). For when the release run's macOS lane failed on a
|
||||
# bug in our own workflow: a re-run uses the tag's copy of the files, so the
|
||||
# fix has to come from main. An Apple-side hold doesn't need this: "Re-run
|
||||
# failed jobs" on the release run finishes the same submission.
|
||||
#
|
||||
# Dispatch from main with the release tag. The check refuses to go on unless
|
||||
# only .github/ and docs/ differ from the tag, so the zip is the tagged app.
|
||||
#
|
||||
# SECURITY: the build is macos-signed.yml, gated by the apple-macos
|
||||
# Environment. NEVER add a `pull_request` trigger; see macos-signed.yml.
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
tag:
|
||||
description: "Release tag to attach the macOS zip to, e.g. v1.8.1"
|
||||
required: true
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
concurrency:
|
||||
group: macos-manual
|
||||
cancel-in-progress: false
|
||||
|
||||
jobs:
|
||||
check:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Builds only the tagged app
|
||||
env:
|
||||
TAG: ${{ inputs.tag }}
|
||||
run: bash .github/scripts/macos-manual-check.sh "${TAG}"
|
||||
- name: The release exists and has no macOS zip yet
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
TAG: ${{ inputs.tag }}
|
||||
run: |
|
||||
set -eu
|
||||
ASSETS="$(gh release view "${TAG}" --repo "${GITHUB_REPOSITORY}" --json assets --jq '.assets[].name')" || {
|
||||
echo "::error::There is no release for ${TAG}."
|
||||
exit 1
|
||||
}
|
||||
if printf '%s\n' "${ASSETS}" | grep -qx 'offband-macos.zip'; then
|
||||
echo "::error::The ${TAG} release already has offband-macos.zip. Delete it from the release first if it has to be replaced."
|
||||
exit 1
|
||||
fi
|
||||
echo "Release ${TAG} exists and has no macOS zip."
|
||||
|
||||
macos:
|
||||
needs: check
|
||||
uses: ./.github/workflows/macos-signed.yml
|
||||
secrets: inherit
|
||||
|
||||
attach:
|
||||
needs: [check, macos]
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write # upload one asset to the existing release
|
||||
steps:
|
||||
- uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: release-macos
|
||||
- name: Attach macOS asset
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
TAG: ${{ inputs.tag }}
|
||||
run: gh release upload "${TAG}" offband-macos.zip --repo "${GITHUB_REPOSITORY}"
|
||||
Loading…
Reference in new issue