James Read 21 часов назад
Родитель
Сommit
c640eb80e1

+ 60 - 12
.github/workflows/build-and-release.yml

@@ -22,6 +22,7 @@ on:
       - 'var/entities/**'
       - 'var/entities/**'
       - 'var/helper-actions/**'
       - 'var/helper-actions/**'
       - 'var/macos/**'
       - 'var/macos/**'
+      - 'var/release/**'
       - 'var/sbom/**'
       - 'var/sbom/**'
       - 'var/windows/**'
       - 'var/windows/**'
   workflow_dispatch:
   workflow_dispatch:
@@ -51,6 +52,7 @@ on:
       - 'var/entities/**'
       - 'var/entities/**'
       - 'var/helper-actions/**'
       - 'var/helper-actions/**'
       - 'var/macos/**'
       - 'var/macos/**'
+      - 'var/release/**'
       - 'var/sbom/**'
       - 'var/sbom/**'
       - 'var/windows/**'
       - 'var/windows/**'
 
 
@@ -173,13 +175,6 @@ jobs:
         if: env.WILL_PUBLISH == 'true'
         if: env.WILL_PUBLISH == 'true'
         uses: docker/setup-buildx-action@v4
         uses: docker/setup-buildx-action@v4
 
 
-      - name: Verify macOS signing certificate chain
-        if: env.WILL_PUBLISH == 'true'
-        env:
-          MACOS_SIGN_P12: ${{ secrets.MACOS_SIGN_P12 }}
-          MACOS_SIGN_PASSWORD: ${{ secrets.MACOS_SIGN_PASSWORD }}
-        run: ./var/macos/verify-macos-sign-p12.sh
-
       - name: Authenticate git for release
       - name: Authenticate git for release
         if: env.WILL_PUBLISH == 'true'
         if: env.WILL_PUBLISH == 'true'
         env:
         env:
@@ -206,11 +201,6 @@ jobs:
         env:
         env:
           GITHUB_TOKEN: ${{ secrets.CONTAINER_TOKEN }}
           GITHUB_TOKEN: ${{ secrets.CONTAINER_TOKEN }}
           GH_TOKEN: ${{ secrets.CONTAINER_TOKEN }}
           GH_TOKEN: ${{ secrets.CONTAINER_TOKEN }}
-          MACOS_SIGN_P12: ${{ secrets.MACOS_SIGN_P12 }}
-          MACOS_SIGN_PASSWORD: ${{ secrets.MACOS_SIGN_PASSWORD }}
-          MACOS_NOTARY_KEY: ${{ secrets.MACOS_NOTARY_KEY }}
-          MACOS_NOTARY_KEY_ID: ${{ secrets.MACOS_NOTARY_KEY_ID }}
-          MACOS_NOTARY_ISSUER_ID: ${{ secrets.MACOS_NOTARY_ISSUER_ID }}
 
 
       - name: Upload unsigned Windows zip for SignPath
       - name: Upload unsigned Windows zip for SignPath
         id: upload-windows-zip
         id: upload-windows-zip
@@ -232,6 +222,14 @@ jobs:
           archive: false
           archive: false
           if-no-files-found: error
           if-no-files-found: error
 
 
+      - name: Upload unsigned macOS archives for signing
+        if: steps.release.outputs.new_release_published == 'true'
+        uses: actions/upload-artifact@v7
+        with:
+          name: unsigned-darwin
+          path: dist/OliveTin-darwin-*.tar.gz
+          if-no-files-found: error
+
       - name: Archive binaries
       - name: Archive binaries
         if: env.WILL_PUBLISH == 'true'
         if: env.WILL_PUBLISH == 'true'
         uses: actions/upload-artifact@v7
         uses: actions/upload-artifact@v7
@@ -244,6 +242,10 @@ jobs:
     needs: build
     needs: build
     if: needs.build.outputs.new_release_published == 'true'
     if: needs.build.outputs.new_release_published == 'true'
     runs-on: ubuntu-latest
     runs-on: ubuntu-latest
+    # Shared with sign-macos: both read-modify-write the release's checksums.txt.
+    concurrency:
+      group: release-signed-assets-${{ github.run_id }}
+      cancel-in-progress: false
     permissions:
     permissions:
       actions: read
       actions: read
       contents: write
       contents: write
@@ -320,3 +322,49 @@ jobs:
             "${{ needs.build.outputs.new_release_git_tag }}" \
             "${{ needs.build.outputs.new_release_git_tag }}" \
             "${zip_path}" \
             "${zip_path}" \
             "${msi_path}"
             "${msi_path}"
+
+  # Runs after the release is published, like sign-windows, so an Apple-side
+  # failure (expired agreement, notary outage, cert problem) does not fail the
+  # release: it only leaves the macOS assets missing until this job is re-run.
+  sign-macos:
+    name: Sign macOS artifacts (quill)
+    needs: build
+    if: needs.build.outputs.new_release_published == 'true'
+    runs-on: ubuntu-latest
+    permissions:
+      actions: read
+      contents: write
+    concurrency:
+      group: release-signed-assets-${{ github.run_id }}
+      cancel-in-progress: false
+    steps:
+      - name: Checkout
+        uses: actions/checkout@v6
+        with:
+          persist-credentials: false
+
+      - name: Setup Go
+        uses: actions/setup-go@v6
+        with:
+          go-version-file: 'service/go.mod'
+          cache: false
+
+      - name: Download unsigned macOS archives
+        uses: actions/download-artifact@v8
+        with:
+          name: unsigned-darwin
+          path: unsigned-darwin
+
+      - name: Sign, notarize and upload macOS archives
+        env:
+          GH_TOKEN: ${{ secrets.CONTAINER_TOKEN }}
+          GITHUB_TOKEN: ${{ secrets.CONTAINER_TOKEN }}
+          MACOS_SIGN_P12: ${{ secrets.MACOS_SIGN_P12 }}
+          MACOS_SIGN_PASSWORD: ${{ secrets.MACOS_SIGN_PASSWORD }}
+          MACOS_NOTARY_KEY: ${{ secrets.MACOS_NOTARY_KEY }}
+          MACOS_NOTARY_KEY_ID: ${{ secrets.MACOS_NOTARY_KEY_ID }}
+          MACOS_NOTARY_ISSUER_ID: ${{ secrets.MACOS_NOTARY_ISSUER_ID }}
+        run: |
+          ./var/macos/sign-and-publish.sh \
+            "${{ needs.build.outputs.new_release_git_tag }}" \
+            unsigned-darwin

+ 38 - 24
.goreleaser.yml

@@ -6,7 +6,7 @@ before:
     - make windows-resources VERSION={{ .Version }}
     - make windows-resources VERSION={{ .Version }}
 
 
 builds:
 builds:
-  # id defaults to project_name (OliveTin) — required for notarize.macos defaults.
+  # id defaults to project_name (OliveTin).
   - skip: '{{ isEnvSet "GORELEASER_SKIP_BUILD" }}'
   - skip: '{{ isEnvSet "GORELEASER_SKIP_BUILD" }}'
     env:
     env:
       - CGO_ENABLED=0
       - CGO_ENABLED=0
@@ -15,7 +15,6 @@ builds:
     dir: service
     dir: service
     goos:
     goos:
       - linux
       - linux
-      - darwin
       - freebsd
       - freebsd
 
 
     goarch:
     goarch:
@@ -29,10 +28,23 @@ builds:
       - 6
       - 6
       - 7
       - 7
 
 
-    ignore:
-      - goos: darwin
-        goarch: arm # Mac does not work on [32bit] arm
+    ldflags:
+      - -s -w -X main.version={{.Version}} -X main.commit={{.ShortCommit}} -X main.date={{ .CommitDate }}
 
 
+  # Built and archived unsigned, but excluded from the GitHub release upload.
+  # The sign-macos job signs/notarizes with quill and uploads them afterwards.
+  - id: darwin
+    skip: '{{ isEnvSet "GORELEASER_SKIP_BUILD" }}'
+    env:
+      - CGO_ENABLED=0
+    binary: OliveTin
+    main: .
+    dir: service
+    goos:
+      - darwin
+    goarch:
+      - amd64
+      - arm64
     ldflags:
     ldflags:
       - -s -w -X main.version={{.Version}} -X main.commit={{.ShortCommit}} -X main.date={{ .CommitDate }}
       - -s -w -X main.version={{.Version}} -X main.commit={{.ShortCommit}} -X main.date={{ .CommitDate }}
 
 
@@ -53,7 +65,8 @@ builds:
 
 
 checksum:
 checksum:
   name_template: 'checksums.txt'
   name_template: 'checksums.txt'
-  # Exclude the windows archive; signed zip/MSI checksums are added after SignPath.
+  # Exclude the windows and darwin archives; their checksums are added by the
+  # sign-windows / sign-macos jobs once signed.
   ids:
   ids:
     - default
     - default
     - openrc
     - openrc
@@ -115,6 +128,22 @@ archives:
     name_template: "{{ .ProjectName }}-{{ .Os }}-{{ .Arch }}{{ .Arm }}"
     name_template: "{{ .ProjectName }}-{{ .Os }}-{{ .Arch }}{{ .Arm }}"
     wrap_in_directory: true
     wrap_in_directory: true
 
 
+  - id: darwin
+    ids:
+      - darwin
+    formats: tar.gz
+    files:
+      - config.yaml
+      - LICENSE
+      - README.md
+      - src: Dockerfile.singlearch
+        dst: Dockerfile
+      - examples/backupScript.sh
+      - webui
+      - var
+    name_template: "{{ .ProjectName }}-{{ .Os }}-{{ .Arch }}{{ .Arm }}"
+    wrap_in_directory: true
+
   - id: windows
   - id: windows
     ids:
     ids:
       - windows
       - windows
@@ -224,25 +253,10 @@ nfpms:
       - src: var/manpage/OliveTin.1.gz
       - src: var/manpage/OliveTin.1.gz
         dst: /usr/share/man/man1/OliveTin.1.gz
         dst: /usr/share/man/man1/OliveTin.1.gz
 
 
-# Sign and notarize darwin binaries via quill (no macOS runner required).
-# Skipped when MACOS_SIGN_P12 is unset so local/snapshot builds stay unsigned.
-notarize:
-  macos:
-    - enabled: '{{ isEnvSet "MACOS_SIGN_P12" }}'
-      # Defaults to project_name when omitted; must match builds[].id (also project_name).
-      sign:
-        certificate: "{{.Env.MACOS_SIGN_P12}}"
-        password: "{{.Env.MACOS_SIGN_PASSWORD}}"
-      notarize:
-        issuer_id: "{{.Env.MACOS_NOTARY_ISSUER_ID}}"
-        key_id: "{{.Env.MACOS_NOTARY_KEY_ID}}"
-        key: "{{.Env.MACOS_NOTARY_KEY}}"
-        wait: true
-        # Apple rejects notary auth tokens with lifetimes over 20m.
-        timeout: 20m
-
 release:
 release:
-  # Publish immediately without Windows assets; sign-windows uploads signed zip/MSI later.
+  # Publish immediately without Windows/macOS assets; sign-windows and sign-macos
+  # upload the signed zip/MSI and darwin tarballs later, so a signing outage
+  # cannot block a release.
   draft: false
   draft: false
   # semantic-release's github plugin creates a draft release first (for issue comments);
   # semantic-release's github plugin creates a draft release first (for issue comments);
   # adopt it and replace its placeholder notes rather than creating a second release.
   # adopt it and replace its placeholder notes rather than creating a second release.

+ 3 - 2
README.md

@@ -9,8 +9,9 @@
 [![Awesome](https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg)](https://github.com/awesome-selfhosted/awesome-selfhosted#automation)
 [![Awesome](https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg)](https://github.com/awesome-selfhosted/awesome-selfhosted#automation)
 [![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/5050/badge)](https://bestpractices.coreinfrastructure.org/projects/5050)
 [![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/5050/badge)](https://bestpractices.coreinfrastructure.org/projects/5050)
 
 
-[![Go Report Card](https://goreportcard.com/badge/github.com/Olivetin/OliveTin)](https://goreportcard.com/report/github.com/OliveTin/OliveTin)
-[![AI Autonomy Level](https://img.shields.io/badge/AI%20Autonomy-Level%202%20of%205%20(pair--programmer)-blue)](https://blog.jread.com/posts/ai-levels-of-autonomy-in-software-engineering/)
+Original development (first 4 years) [![AI Autonomy Level 0 of 5 (no AI)](https://img.shields.io/badge/AI%20Autonomy-Level%200%20of%205%20(no--ai)-blue)](https://blog.jread.com/posts/ai-levels-of-autonomy-in-software-engineering/)
+
+Current development [![AI Autonomy Level 3 of 5 (semi-autonomous engineer)](https://img.shields.io/badge/AI%20Autonomy-Level%203%20of%205%20(semi--autonomous--engineer)-blue)](https://blog.jread.com/posts/ai-levels-of-autonomy-in-software-engineering/)
 
 
 OliveTin 2k is end of life - see the [OliveTin 2k to 3k upgrade guide](https://docs.olivetin.app/upgrade/2k3k.html)
 OliveTin 2k is end of life - see the [OliveTin 2k to 3k upgrade guide](https://docs.olivetin.app/upgrade/2k3k.html)
 </div>
 </div>

+ 1 - 1
docs/modules/ROOT/pages/upgrade/upgrade_notes.adoc

@@ -3,7 +3,7 @@
 
 
 OliveTin releases are published to GitHub, and the release notes are contained there. This page includes a summary of "Upgrade Notes" for breaking changes between releases.
 OliveTin releases are published to GitHub, and the release notes are contained there. This page includes a summary of "Upgrade Notes" for breaking changes between releases.
 
 
-== Next release (unreleased)
+== 3000.23.0
 
 
 [#require-guests-to-login-all-api-calls]
 [#require-guests-to-login-all-api-calls]
 === `authRequireGuestsToLogin` now applies to every API call and ACL
 === `authRequireGuestsToLogin` now applies to every API call and ACL

+ 47 - 8
docs/modules/dev/pages/signing.adoc

@@ -2,14 +2,52 @@
 
 
 OliveTin signs release binaries on two platforms:
 OliveTin signs release binaries on two platforms:
 
 
-* **macOS** — Developer ID + notarization via [quill](https://github.com/anchore/quill) inside GoReleaser (optional only when `MACOS_SIGN_P12` is unset).
+* **macOS** — Developer ID + notarization via [quill](https://github.com/anchore/quill) in a separate GitHub Actions job (signed darwin tarballs are uploaded after the release is published).
 * **Windows** — Authenticode via [SignPath Foundation](https://signpath.org/) in a separate GitHub Actions job (signed zip/MSI are uploaded after the release is published).
 * **Windows** — Authenticode via [SignPath Foundation](https://signpath.org/) in a separate GitHub Actions job (signed zip/MSI are uploaded after the release is published).
 
 
 ## macOS release signing
 ## macOS release signing
 
 
-Release builds can sign and notarize the `darwin` binaries using [quill](https://github.com/anchore/quill) via GoReleaser. This runs on the existing Linux CI runner; no macOS runner or Xcode is required.
+Release builds sign and notarize the `darwin` binaries using [quill](https://github.com/anchore/quill). This runs on a Linux CI runner; no macOS runner or Xcode is required.
 
 
-Signing is **optional** only when `MACOS_SIGN_P12` is unset — GoReleaser then skips macOS signing and publishes unsigned binaries. When `MACOS_SIGN_P12` is set, the companion macOS secrets below are required or the release fails.
+Like Windows signing, this happens **after** the release is published, so a problem on Apple's side cannot block a release:
+
+1. GoReleaser builds `OliveTin-darwin-{amd64,arm64}.tar.gz` unsigned and leaves them out of the GitHub release and `checksums.txt`. The `build` job uploads them as the `unsigned-darwin` workflow artifact.
+2. The `sign-macos` job checks the `.p12` chain, then signs and notarizes each binary with quill, repacks the tarballs and checks the designated requirement.
+3. The job uploads the signed tarballs to the release and adds their lines to `checksums.txt`.
+
+If `sign-macos` fails (for example an expired Apple agreement, a notary outage or a certificate problem), the release stays published without macOS assets. Fix the cause, then use **Re-run failed jobs** on that workflow run. The unsigned artifact must still be within its retention period.
+
+The signed files are uploaded before `checksums.txt`. If the `checksums.txt` upload still fails after retries, the job fails and the release holds the new files with an out-of-date manifest. A re-run updates the release's current `checksums.txt` and uploads it again. If the failed upload left the release with no `checksums.txt`, or with one GitHub has not marked as fully uploaded, the re-run rebuilds it from the sha256 digests GitHub records for each release asset.
+
+A re-run trusts a fully uploaded `checksums.txt`. It only adds or replaces lines for the files it signs, so it cannot restore entries for other assets that are missing from it.
+
+Rebuild the manifest by hand from the release's own files when a fully uploaded `checksums.txt` is missing entries for other assets, or when a release asset has no recorded digest (the rebuild then stops and the re-run fails). Then re-run the job.
+
+Before you start, make sure no `sign-windows` or `sign-macos` job is running or queued for the release. The manual commands are outside the jobs' concurrency group, so a job that updates `checksums.txt` while they run would have its lines overwritten.
+
+The commands run in a subshell that stops at the first error, so a failed download or hash never uploads a partial manifest. They also stop if any asset other than `checksums.txt` is not fully uploaded, because hashing a partial file would publish a checksum for the wrong bytes. Upload that asset again, or delete it with `gh release delete-asset`, then run the commands again. A signed file deleted here is uploaded again when you re-run the job that signed it: `sign-windows` for Windows files, `sign-macos` for macOS files.
+
+[source,bash]
+----
+(
+  set -euo pipefail
+  tag=<tag>
+  incomplete="$(gh release view "${tag}" --repo OliveTin/OliveTin --json assets \
+    --jq '.assets[] | select(.name != "checksums.txt" and .state != "uploaded") | .name')"
+  if [[ -n "${incomplete}" ]]; then
+    echo "Not fully uploaded: ${incomplete}" >&2
+    exit 1
+  fi
+  workdir="$(mktemp -d)"
+  mkdir "${workdir}/assets"
+  gh release download "${tag}" --repo OliveTin/OliveTin --dir "${workdir}/assets"
+  rm -f "${workdir}/assets/checksums.txt"
+  (cd "${workdir}/assets" && sha256sum -- *) > "${workdir}/checksums.txt"
+  gh release upload "${tag}" "${workdir}/checksums.txt" --repo OliveTin/OliveTin --clobber
+)
+----
+
+`sign-windows` and `sign-macos` share a concurrency group, so they never update `checksums.txt` at the same time.
 
 
 ### Prerequisites
 ### Prerequisites
 
 
@@ -99,7 +137,7 @@ In **Settings → Secrets and variables → Actions**, create:
 | `MACOS_NOTARY_KEY_ID` | Key ID from App Store Connect (e.g. `ABC123DEF4`) |
 | `MACOS_NOTARY_KEY_ID` | Key ID from App Store Connect (e.g. `ABC123DEF4`) |
 | `MACOS_NOTARY_ISSUER_ID` | Issuer UUID from App Store Connect |
 | `MACOS_NOTARY_ISSUER_ID` | Issuer UUID from App Store Connect |
 
 
-All five must be present for signing to run. GoReleaser enables the step when `MACOS_SIGN_P12` is set; missing companion secrets will fail that release.
+All five must be present; `sign-macos` fails (without affecting the published release) if any are missing.
 
 
 ### Renewal
 ### Renewal
 
 
@@ -108,6 +146,7 @@ All five must be present for signing to run. GoReleaser enables the step when `M
 | Developer ID Application certificate | ~5 years | Create a new certificate in the Apple portal, export a new **full-chain** `.p12` (leaf + G2 intermediate + Apple Root CA), update `MACOS_SIGN_P12` and `MACOS_SIGN_PASSWORD`. |
 | Developer ID Application certificate | ~5 years | Create a new certificate in the Apple portal, export a new **full-chain** `.p12` (leaf + G2 intermediate + Apple Root CA), update `MACOS_SIGN_P12` and `MACOS_SIGN_PASSWORD`. |
 | App Store Connect API key | Does not expire, but can be revoked | Create a new key if compromised or lost; update `MACOS_NOTARY_KEY`, `MACOS_NOTARY_KEY_ID`, and optionally `MACOS_NOTARY_ISSUER_ID`. |
 | App Store Connect API key | Does not expire, but can be revoked | Create a new key if compromised or lost; update `MACOS_NOTARY_KEY`, `MACOS_NOTARY_KEY_ID`, and optionally `MACOS_NOTARY_ISSUER_ID`. |
 | Apple Developer Program | Annual subscription | Renew membership before it lapses; existing certificates stop working if the account is inactive. |
 | Apple Developer Program | Annual subscription | Renew membership before it lapses; existing certificates stop working if the account is inactive. |
+| Apple Developer agreements | Re-issued by Apple from time to time | When Apple publishes an updated Program License Agreement, the Account Holder must accept it at https://developer.apple.com/account. Until then notarization fails with `403 FORBIDDEN.REQUIRED_AGREEMENTS_MISSING_OR_EXPIRED`. |
 
 
 After updating secrets, the next release on `main` (via semantic-release) will use the new credentials automatically.
 After updating secrets, the next release on `main` (via semantic-release) will use the new credentials automatically.
 
 
@@ -116,7 +155,7 @@ After updating secrets, the next release on `main` (via semantic-release) will u
 From any platform (no Mac required), check that quill did **not** emit the broken `certificate root[...]` designated requirement:
 From any platform (no Mac required), check that quill did **not** emit the broken `certificate root[...]` designated requirement:
 
 
 ```sh
 ```sh
-go install github.com/anchore/quill/cmd/quill@latest
+go install github.com/anchore/quill/cmd/quill@v0.7.1
 quill describe OliveTin-darwin-arm64/OliveTin
 quill describe OliveTin-darwin-arm64/OliveTin
 ```
 ```
 
 
@@ -134,11 +173,11 @@ spctl -a -vv -t execute OliveTin-darwin-arm64/OliveTin
 
 
 ### Configuration reference
 ### Configuration reference
 
 
-- GoReleaser: `notarize.macos` in link:https://github.com/OliveTin/OliveTin/blob/main/.goreleaser.yml[`.goreleaser.yml`]
-- CI secrets: link:https://github.com/OliveTin/OliveTin/blob/main/.github/workflows/build-and-release.yml[`.github/workflows/build-and-release.yml`] (`release` step)
+- GoReleaser: the `darwin` build and archive in link:https://github.com/OliveTin/OliveTin/blob/main/.goreleaser.yml[`.goreleaser.yml`]
+- CI job and secrets: link:https://github.com/OliveTin/OliveTin/blob/main/.github/workflows/build-and-release.yml[`.github/workflows/build-and-release.yml`] (`sign-macos` job)
+- Sign, notarize and upload: link:https://github.com/OliveTin/OliveTin/blob/main/var/macos/sign-and-publish.sh[`var/macos/sign-and-publish.sh`]
 - CI preflight (3-cert P12): link:https://github.com/OliveTin/OliveTin/blob/main/var/macos/verify-macos-sign-p12.sh[`var/macos/verify-macos-sign-p12.sh`]
 - CI preflight (3-cert P12): link:https://github.com/OliveTin/OliveTin/blob/main/var/macos/verify-macos-sign-p12.sh[`var/macos/verify-macos-sign-p12.sh`]
 - CI post-sign check (designated requirement): link:https://github.com/OliveTin/OliveTin/blob/main/var/macos/verify-signed-darwin.sh[`var/macos/verify-signed-darwin.sh`]
 - CI post-sign check (designated requirement): link:https://github.com/OliveTin/OliveTin/blob/main/var/macos/verify-signed-darwin.sh[`var/macos/verify-signed-darwin.sh`]
-- link:https://goreleaser.com/customization/notarize/[GoReleaser notarization docs]
 
 
 ## Windows release signing (SignPath)
 ## Windows release signing (SignPath)
 
 

+ 3 - 3
frontend/package-lock.json

@@ -1724,9 +1724,9 @@
 			}
 			}
 		},
 		},
 		"node_modules/cross-spawn": {
 		"node_modules/cross-spawn": {
-			"version": "7.0.6",
-			"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz",
-			"integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==",
+			"version": "7.1.2",
+			"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.1.2.tgz",
+			"integrity": "sha512-8BPK2r+sKWC8sDinRwLwrFMq2lXTBBwzYYEB9LiCznfMurOi4FOvQflq3XOLGG+HPdMSVpe+k/s96+AtDEOgPg==",
 			"dev": true,
 			"dev": true,
 			"license": "MIT",
 			"license": "MIT",
 			"dependencies": {
 			"dependencies": {

+ 91 - 0
var/macos/sign-and-publish.sh

@@ -0,0 +1,91 @@
+#!/usr/bin/env bash
+# Post-release: sign and notarize the darwin binaries inside the unsigned
+# OliveTin-darwin-*.tar.gz archives, repack them, check the designated
+# requirement, then upload them (and their checksums) to the GitHub release.
+#
+# Runs in the sign-macos job after GoReleaser has already published the
+# release, so an Apple-side problem (expired agreement, notary outage,
+# revoked cert) leaves the release out but missing its macOS assets instead
+# of failing it. Re-run the job once fixed.
+#
+# Usage: sign-and-publish.sh <release-tag> <unsigned-archive-dir>
+set -euo pipefail
+
+SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
+REPO_ROOT="$(cd "${SCRIPT_DIR}/../.." && pwd)"
+QUILL_VERSION="${QUILL_VERSION:-v0.7.1}"
+export QUILL_VERSION
+
+TAG="${1:-}"
+UNSIGNED_DIR="${2:-}"
+if [[ -z "${TAG}" || -z "${UNSIGNED_DIR}" ]]; then
+  echo "Usage: $(basename "$0") <release-tag> <unsigned-archive-dir>" >&2
+  exit 1
+fi
+
+missing=0
+for name in MACOS_SIGN_P12 MACOS_SIGN_PASSWORD MACOS_NOTARY_KEY MACOS_NOTARY_KEY_ID MACOS_NOTARY_ISSUER_ID; do
+  if [[ -z "${!name:-}" ]]; then
+    echo "Missing required macOS signing secret: ${name}" >&2
+    missing=1
+  fi
+done
+if [[ "${missing}" -ne 0 ]]; then
+  echo "macOS signing secrets are required to upload signed macOS assets. See docs/modules/dev/pages/signing.adoc." >&2
+  exit 1
+fi
+
+"${SCRIPT_DIR}/verify-macos-sign-p12.sh"
+
+if ! command -v quill >/dev/null 2>&1; then
+  echo "Installing quill ${QUILL_VERSION}..."
+  go install "github.com/anchore/quill/cmd/quill@${QUILL_VERSION}"
+  export PATH="$(go env GOPATH)/bin:${PATH}"
+fi
+
+shopt -s nullglob
+archives=("${UNSIGNED_DIR}"/OliveTin-darwin-*.tar.gz)
+if [[ "${#archives[@]}" -eq 0 ]]; then
+  echo "No OliveTin-darwin-*.tar.gz archives found under ${UNSIGNED_DIR}." >&2
+  exit 1
+fi
+
+workdir="$(mktemp -d)"
+trap 'rm -rf "${workdir}"' EXIT
+signed_dir="${workdir}/signed"
+mkdir -p "${signed_dir}"
+
+# Secrets can carry trailing newlines; quill wants clean base64 or a path.
+p12_path="${workdir}/sign.p12"
+key_path="${workdir}/notary.p8"
+printf '%s' "${MACOS_SIGN_P12}" | tr -d '\n\r' | base64 -d >"${p12_path}"
+printf '%s' "${MACOS_NOTARY_KEY}" | tr -d '\n\r' | base64 -d >"${key_path}"
+
+for archive in "${archives[@]}"; do
+  name="$(basename "${archive}" .tar.gz)"
+  extract_dir="${workdir}/${name}"
+  mkdir -p "${extract_dir}"
+  tar -xzf "${archive}" -C "${extract_dir}"
+
+  # GoReleaser wraps archives in a directory named after the archive.
+  binary="${extract_dir}/${name}/OliveTin"
+  if [[ ! -f "${binary}" ]] || ! file "${binary}" | grep -qi 'Mach-O'; then
+    echo "Mach-O binary not found at ${name}/OliveTin inside ${archive}." >&2
+    exit 1
+  fi
+
+  echo "Signing and notarizing ${name}/OliveTin..."
+  QUILL_SIGN_PASSWORD="${MACOS_SIGN_PASSWORD}" \
+    quill sign-and-notarize "${binary}" \
+      --p12 "${p12_path}" \
+      --notary-issuer "${MACOS_NOTARY_ISSUER_ID}" \
+      --notary-key-id "${MACOS_NOTARY_KEY_ID}" \
+      --notary-key "${key_path}"
+
+  tar --sort=name --owner=0 --group=0 --numeric-owner \
+    -czf "${signed_dir}/${name}.tar.gz" -C "${extract_dir}" "${name}"
+done
+
+"${SCRIPT_DIR}/verify-signed-darwin.sh" "${signed_dir}"
+
+"${REPO_ROOT}/var/release/publish-signed-assets.sh" "${TAG}" "${signed_dir}"/OliveTin-darwin-*.tar.gz

+ 5 - 3
var/macos/verify-signed-darwin.sh

@@ -1,6 +1,8 @@
 #!/usr/bin/env bash
 #!/usr/bin/env bash
 # Post-sign: fail if quill embedded the broken designated requirement
 # Post-sign: fail if quill embedded the broken designated requirement
 # certificate root[field.1.2.840.113635.100.6.2.6] (missing Apple Root in P12).
 # certificate root[field.1.2.840.113635.100.6.2.6] (missing Apple Root in P12).
+#
+# Usage: verify-signed-darwin.sh [archive-dir]   (default: dist/)
 set -euo pipefail
 set -euo pipefail
 
 
 if [[ -z "${MACOS_SIGN_P12:-}" ]]; then
 if [[ -z "${MACOS_SIGN_P12:-}" ]]; then
@@ -10,14 +12,15 @@ fi
 
 
 SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
 SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
 REPO_ROOT="$(cd "${SCRIPT_DIR}/../.." && pwd)"
 REPO_ROOT="$(cd "${SCRIPT_DIR}/../.." && pwd)"
-DIST_DIR="${REPO_ROOT}/dist"
+DIST_DIR="${1:-${REPO_ROOT}/dist}"
+QUILL_VERSION="${QUILL_VERSION:-v0.7.1}"
 
 
 BAD_REQ='certificate root\[field\.1\.2\.840\.113635\.100\.6\.2\.6\]'
 BAD_REQ='certificate root\[field\.1\.2\.840\.113635\.100\.6\.2\.6\]'
 GOOD_REQ='certificate 1\[field\.1\.2\.840\.113635\.100\.6\.2\.6\]'
 GOOD_REQ='certificate 1\[field\.1\.2\.840\.113635\.100\.6\.2\.6\]'
 
 
 if ! command -v quill >/dev/null 2>&1; then
 if ! command -v quill >/dev/null 2>&1; then
   echo "Installing quill..."
   echo "Installing quill..."
-  go install github.com/anchore/quill/cmd/quill@latest
+  go install "github.com/anchore/quill/cmd/quill@${QUILL_VERSION}"
   export PATH="$(go env GOPATH)/bin:${PATH}"
   export PATH="$(go env GOPATH)/bin:${PATH}"
 fi
 fi
 
 
@@ -52,7 +55,6 @@ for archive in "${archives[@]}"; do
     exit 1
     exit 1
   fi
   fi
 
 
-
   echo "Checking designated requirement in ${archive}..."
   echo "Checking designated requirement in ${archive}..."
   describe_out="$(quill describe "${binary}")"
   describe_out="$(quill describe "${binary}")"
   if echo "${describe_out}" | grep -qE "${BAD_REQ}"; then
   if echo "${describe_out}" | grep -qE "${BAD_REQ}"; then

+ 122 - 0
var/release/publish-signed-assets.sh

@@ -0,0 +1,122 @@
+#!/usr/bin/env bash
+# Upload signed assets to an already-published GitHub release and add/replace
+# their lines in the release's checksums.txt.
+#
+# Used by the post-release signing jobs (sign-windows, sign-macos). Those jobs
+# share a concurrency group so two of them never read-modify-write
+# checksums.txt at the same time.
+set -euo pipefail
+
+SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
+REPO_ROOT="$(cd "${SCRIPT_DIR}/../.." && pwd)"
+DIST_DIR="${DIST_DIR:-${REPO_ROOT}/dist}"
+CHECKSUMS_NAME="checksums.txt"
+
+usage() {
+  echo "Usage: $(basename "$0") <release-tag> <signed-file> [<signed-file>...]" >&2
+  echo "Each file is uploaded under its basename." >&2
+  exit 1
+}
+
+TAG="${1:-}"
+[[ -n "${TAG}" && "$#" -ge 2 ]] || usage
+shift
+
+if ! command -v gh >/dev/null; then
+  echo "gh is required to update the GitHub release" >&2
+  exit 1
+fi
+
+mkdir -p "${DIST_DIR}"
+
+names=()
+for src in "$@"; do
+  if [[ ! -f "${src}" ]]; then
+    echo "Signed file not found: ${src}" >&2
+    exit 1
+  fi
+  name="$(basename "${src}")"
+  if [[ "$(realpath "${src}")" != "$(realpath -m "${DIST_DIR}/${name}")" ]]; then
+    cp -f "${src}" "${DIST_DIR}/${name}"
+  fi
+  names+=("${name}")
+done
+
+checksums_path="${DIST_DIR}/${CHECKSUMS_NAME}"
+
+# gh release upload --clobber deletes the old asset before uploading, so an
+# earlier run that failed to upload the manifest can leave the release without
+# one, or with an incomplete one. The manifest lists every other release asset, so it can be rebuilt from
+# the sha256 digests GitHub records for them.
+rebuild_checksums() {
+  echo "${CHECKSUMS_NAME} is missing or incomplete on release ${TAG}; rebuilding it from release asset digests" >&2
+  local assets
+  assets="$(gh release view "${TAG}" --json assets \
+    --jq ".assets[] | select(.name != \"${CHECKSUMS_NAME}\") | \"\(.digest // \"none\") \(.name)\"")"
+
+  : > "${checksums_path}"
+  local digest name
+  while read -r digest name; do
+    [[ -n "${name}" ]] || continue
+    if [[ "${digest}" != sha256:* ]]; then
+      echo "Release asset ${name} has no sha256 digest; cannot rebuild ${CHECKSUMS_NAME}" >&2
+      exit 1
+    fi
+    printf '%s  %s\n' "${digest#sha256:}" "${name}" >> "${checksums_path}"
+  done <<< "${assets}"
+}
+
+# A failed upload can leave an empty asset in the "starter" state; only an
+# "uploaded" manifest is complete enough to update.
+uploaded_assets="$(gh release view "${TAG}" --json assets --jq '.assets[] | select(.state == "uploaded") | .name')"
+if grep -qxF "${CHECKSUMS_NAME}" <<< "${uploaded_assets}"; then
+  if ! gh release download "${TAG}" --pattern "${CHECKSUMS_NAME}" --dir "${DIST_DIR}" --clobber; then
+    echo "Failed to download ${CHECKSUMS_NAME} from release ${TAG}" >&2
+    exit 1
+  fi
+else
+  rebuild_checksums
+fi
+if [[ ! -f "${checksums_path}" ]]; then
+  echo "${CHECKSUMS_NAME} not found after download from release ${TAG}" >&2
+  exit 1
+fi
+
+update_checksum() {
+  local file_name="${1}"
+  local new_checksum
+  new_checksum="$(cd "${DIST_DIR}" && sha256sum "${file_name}")"
+
+  local tmp
+  tmp="$(mktemp)"
+  grep -vF " ${file_name}" "${checksums_path}" > "${tmp}" || true
+  printf '%s\n' "${new_checksum}" >> "${tmp}"
+  mv "${tmp}" "${checksums_path}"
+}
+
+upload_paths=()
+for name in "${names[@]}"; do
+  update_checksum "${name}"
+  upload_paths+=("${DIST_DIR}/${name}")
+done
+
+# --clobber overwrites same-named assets (needed if the sign job is re-run).
+gh release upload "${TAG}" "${upload_paths[@]}" --clobber
+
+# The new archives are already on the release, so only the updated manifest
+# describes them. Retry it rather than restore the old one.
+checksums_attempts=3
+for attempt in $(seq 1 "${checksums_attempts}"); do
+  if gh release upload "${TAG}" "${checksums_path}" --clobber; then
+    break
+  fi
+  if [[ "${attempt}" -eq "${checksums_attempts}" ]]; then
+    echo "Failed to upload updated ${CHECKSUMS_NAME} after ${checksums_attempts} attempts." >&2
+    echo "Release ${TAG} now has signed ${names[*]} but a stale or missing ${CHECKSUMS_NAME}; re-run this job." >&2
+    exit 1
+  fi
+  echo "Upload of ${CHECKSUMS_NAME} failed (attempt ${attempt}/${checksums_attempts}); retrying" >&2
+  sleep $((attempt * 10))
+done
+
+echo "Uploaded signed ${names[*]} to release ${TAG}"

+ 0 - 3
var/windows/goreleaser-release-with-msi.sh

@@ -51,6 +51,3 @@ done
 wait_for_stable_file "${ZIP_PATH}"
 wait_for_stable_file "${ZIP_PATH}"
 "${SCRIPT_DIR}/build-msi.sh"
 "${SCRIPT_DIR}/build-msi.sh"
 wait "${goreleaser_pid}"
 wait "${goreleaser_pid}"
-
-# Fail the release job if macOS signing produced an unsatisfiable designated requirement.
-"${REPO_ROOT}/var/macos/verify-signed-darwin.sh"

+ 9 - 62
var/windows/signpath-publish-signed.sh

@@ -7,7 +7,6 @@ DIST_DIR="${DIST_DIR:-${REPO_ROOT}/dist}"
 ARCH="${ARCH:-amd64}"
 ARCH="${ARCH:-amd64}"
 ZIP_NAME="OliveTin-windows-${ARCH}.zip"
 ZIP_NAME="OliveTin-windows-${ARCH}.zip"
 MSI_NAME="OliveTin-windows-${ARCH}.msi"
 MSI_NAME="OliveTin-windows-${ARCH}.msi"
-CHECKSUMS_NAME="checksums.txt"
 
 
 usage() {
 usage() {
   echo "Usage: $(basename "$0") <release-tag> <signed-zip-path> <signed-msi-path>" >&2
   echo "Usage: $(basename "$0") <release-tag> <signed-zip-path> <signed-msi-path>" >&2
@@ -22,70 +21,18 @@ if [[ -z "${TAG}" || -z "${SIGNED_ZIP}" || -z "${SIGNED_MSI}" ]]; then
   usage
   usage
 fi
 fi
 
 
-if [[ ! -f "${SIGNED_ZIP}" ]]; then
-  echo "Signed zip not found: ${SIGNED_ZIP}" >&2
-  exit 1
-fi
-
-if [[ ! -f "${SIGNED_MSI}" ]]; then
-  echo "Signed MSI not found: ${SIGNED_MSI}" >&2
-  exit 1
-fi
-
-if ! command -v gh >/dev/null; then
-  echo "gh is required to update the GitHub release" >&2
-  exit 1
-fi
+for f in "${SIGNED_ZIP}" "${SIGNED_MSI}"; do
+  if [[ ! -f "${f}" ]]; then
+    echo "Signed file not found: ${f}" >&2
+    exit 1
+  fi
+done
 
 
+# SignPath output names are not guaranteed; publish under the canonical names.
 mkdir -p "${DIST_DIR}"
 mkdir -p "${DIST_DIR}"
 cp -f "${SIGNED_ZIP}" "${DIST_DIR}/${ZIP_NAME}"
 cp -f "${SIGNED_ZIP}" "${DIST_DIR}/${ZIP_NAME}"
 cp -f "${SIGNED_MSI}" "${DIST_DIR}/${MSI_NAME}"
 cp -f "${SIGNED_MSI}" "${DIST_DIR}/${MSI_NAME}"
 
 
-checksums_path="${DIST_DIR}/${CHECKSUMS_NAME}"
-checksums_backup="${DIST_DIR}/${CHECKSUMS_NAME}.orig"
-if ! gh release download "${TAG}" --pattern "${CHECKSUMS_NAME}" --dir "${DIST_DIR}" --clobber; then
-  echo "Failed to download ${CHECKSUMS_NAME} from release ${TAG}" >&2
-  exit 1
-fi
-if [[ ! -f "${checksums_path}" ]]; then
-  echo "${CHECKSUMS_NAME} not found after download from release ${TAG}" >&2
-  exit 1
-fi
-cp -f "${checksums_path}" "${checksums_backup}"
-
-update_checksum() {
-  local file_name="${1}"
-  local new_checksum
-  new_checksum="$(cd "${DIST_DIR}" && sha256sum "${file_name}")"
-
-  if [[ -f "${checksums_path}" ]] && grep -qF " ${file_name}" "${checksums_path}"; then
-    local tmp
-    tmp="$(mktemp)"
-    grep -vF " ${file_name}" "${checksums_path}" > "${tmp}" || true
-    printf '%s\n' "${new_checksum}" >> "${tmp}"
-    mv "${tmp}" "${checksums_path}"
-  else
-    printf '%s\n' "${new_checksum}" >> "${checksums_path}"
-  fi
-}
-
-update_checksum "${ZIP_NAME}"
-update_checksum "${MSI_NAME}"
-
-# Upload binaries first so a failed checksums upload can restore the previous file.
-# --clobber overwrites same-named assets (needed if the sign job is re-run).
-gh release upload "${TAG}" \
+DIST_DIR="${DIST_DIR}" "${REPO_ROOT}/var/release/publish-signed-assets.sh" "${TAG}" \
   "${DIST_DIR}/${ZIP_NAME}" \
   "${DIST_DIR}/${ZIP_NAME}" \
-  "${DIST_DIR}/${MSI_NAME}" \
-  --clobber
-
-if ! gh release upload "${TAG}" "${checksums_path}" --clobber; then
-  echo "Failed to upload updated ${CHECKSUMS_NAME}; restoring previous asset" >&2
-  restore_dir="$(mktemp -d)"
-  cp -f "${checksums_backup}" "${restore_dir}/${CHECKSUMS_NAME}"
-  gh release upload "${TAG}" "${restore_dir}/${CHECKSUMS_NAME}" --clobber
-  rm -rf "${restore_dir}"
-  exit 1
-fi
-
-echo "Uploaded signed ${ZIP_NAME} and ${MSI_NAME} to release ${TAG}"
+  "${DIST_DIR}/${MSI_NAME}"