Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
193 changes: 193 additions & 0 deletions .github/workflows/release-trust.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,193 @@
name: Release trust

# Installed copies of LPM check every update with code they can never
# change, against keys and records that Apple and Sigstore keep changing.
# These checks watch the published releases from the outside every day:
#
# - Apple still vouches for the current stable and nightly macOS apps: the
# notarization ticket stands and the Developer ID certificate isn't
# revoked. Clients check the stapled ticket offline and can't see either.
# - Sigstore still serves the trust root built into LPM, so releases ship
# Sigstore's current keys.
# - The latest stable updates itself to the newest nightly, so a signing or
# packaging change on main that installed updaters would refuse fails
# here before a stable release carries it. Until the first nightly after a
# stable release, the stable before it updates to it instead.
on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
paths:
- 'crates/lpm-cli/assets/sigstore_*'
- 'crates/lpm-cli/src/sigstore_verify/**'
- 'scripts/ci/previous-stable-update-gate.sh'
- 'scripts/ci/semver-newer.py'
- 'scripts/ci/with-apple-service-retry.sh'
- '.github/workflows/release-trust.yml'
schedule:
- cron: '17 6 * * *'
workflow_dispatch:

permissions:
contents: read

concurrency:
group: release-trust-${{ github.ref }}
cancel-in-progress: true

env:
CARGO_INCREMENTAL: '0'
CARGO_PROFILE_DEV_DEBUG: '0'
CARGO_PROFILE_TEST_DEBUG: '0'

jobs:
apple:
name: Apple vouches for the current macOS apps
if: ${{ !github.event.pull_request.draft }}
runs-on: macos-15
timeout-minutes: 20
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

- name: Check each current release with Apple
env:
GH_TOKEN: ${{ github.token }}
run: |
set -euo pipefail
tags=$(curl -fsSL --retry 3 https://registry.npmjs.org/-/package/@lpm-registry/cli/dist-tags)
failed=0
for channel in latest nightly; do
version=$(jq -er --arg channel "$channel" '.[$channel]' <<<"$tags")
release="$RUNNER_TEMP/v$version"
mkdir -p "$release"
gh release download "v$version" --repo lpm-dev/rust-client --dir "$release" \
--pattern SHA256SUMS.txt --pattern 'lpm-darwin-*.zip'
for asset in lpm-darwin-arm64.zip lpm-darwin-x64.zip; do
archive="$release/$asset"
if [ ! -f "$archive" ]; then
echo "::error::v$version has no $asset"
failed=1
continue
fi
(cd "$release" && awk -v asset="$asset" '$2 == asset' SHA256SUMS.txt | shasum -a 256 --check --strict)
unpacked="$RUNNER_TEMP/unpacked/v$version/${asset%.zip}"
mkdir -p "$unpacked"
ditto -x -k "$archive" "$unpacked"
app="$unpacked/LPM CLI.app"
echo "::group::v$version $asset"
if /usr/bin/codesign --verify --strict --verbose=2 "$app" &&
scripts/ci/with-apple-service-retry.sh stapler validate "$app" &&
/usr/sbin/spctl --assess --type execute --verbose=4 "$app"; then
echo "Apple vouches for v$version $asset"
else
echo "::error::Apple no longer vouches for v$version $asset. Installed copies that update to it, and the installer, will refuse it."
failed=1
fi
echo "::endgroup::"
done
done
exit "$failed"

sigstore:
name: Sigstore serves the trust root built into LPM
if: ${{ !github.event.pull_request.draft }}
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: dtolnay/rust-toolchain@683b588c487a69d01f6c6ddf40f036ff682cc2c8 # master
with:
toolchain: '1.99.1'
- uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: release-trust-sigstore-1.99.1-${{ hashFiles('Cargo.lock') }}
restore-keys: release-trust-sigstore-1.99.1-

- name: Install Linux build dependencies
run: bash scripts/ci/install-apt-packages.sh pkg-config libdbus-1-dev

- name: Refresh from Sigstore's live repository
run: |
set -euo pipefail
cargo test --locked -p lpm-cli --bin lpm-rs -- --ignored --exact \
sigstore_verify::trust_store::tests::sigstores_live_repository_serves_the_built_in_trust_root \
| tee "$RUNNER_TEMP/sigstore-live.log"
# A renamed test would match nothing, and cargo passes an empty run.
grep -q '^test result: ok. 1 passed' "$RUNNER_TEMP/sigstore-live.log"

previous-stable-updates-to-newest:
name: Latest stable updates itself to the newest release (${{ matrix.runner }})
if: ${{ !github.event.pull_request.draft }}
strategy:
fail-fast: false
matrix:
include:
- runner: ubuntu-latest
asset: lpm-linux-x64
- runner: ubuntu-24.04-arm
asset: lpm-linux-arm64
- runner: macos-15
asset: lpm-darwin-arm64.zip
- runner: macos-15-intel
asset: lpm-darwin-x64.zip
runs-on: ${{ matrix.runner }}
timeout-minutes: 20
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

- name: Download the release to update to
env:
ASSET: ${{ matrix.asset }}
GH_TOKEN: ${{ github.token }}
run: |
set -euo pipefail
tags=$(curl -fsSL --retry 3 https://registry.npmjs.org/-/package/@lpm-registry/cli/dist-tags)
stable=$(jq -er .latest <<<"$tags")
nightly=$(jq -er .nightly <<<"$tags")
nightly_is_newer=$(python3 -I scripts/ci/semver-newer.py "$nightly" "$stable")
if [ "$nightly_is_newer" = yes ]; then
target=$nightly
channel=nightly
previous=$stable
else
# Until the next nightly, the newest one predates the latest
# stable, so check the update to that stable from the one before.
target=$stable
channel=stable
previous=$(gh release list --repo lpm-dev/rust-client --exclude-drafts --exclude-pre-releases \
--limit 2 --json tagName --jq '.[1].tagName')
previous=${previous#v}
fi
release="$RUNNER_TEMP/release"
gh release download "v$target" --repo lpm-dev/rust-client --dir "$release" \
--pattern SHA256SUMS.txt --pattern SHA256SUMS.txt.sigstore --pattern "$ASSET"
gh release view "v$target" --repo lpm-dev/rust-client --json targetCommitish,publishedAt \
> "$RUNNER_TEMP/release.json"
{
echo "TARGET_VERSION=$target"
echo "TARGET_CHANNEL=$channel"
echo "TARGET_COMMIT=$(jq -er .targetCommitish "$RUNNER_TEMP/release.json")"
echo "TARGET_PUBLISHED_AT=$(jq -er .publishedAt "$RUNNER_TEMP/release.json")"
echo "TARGET_RELEASE=$release"
echo "PREVIOUS_VERSION=$previous"
} >> "$GITHUB_ENV"

- name: Update the previous stable to it through its own updater
run: >-
scripts/ci/previous-stable-update-gate.sh
--previous "$PREVIOUS_VERSION"
--published-at "$TARGET_PUBLISHED_AT"
"$TARGET_RELEASE" "$TARGET_VERSION" "$TARGET_COMMIT" "$TARGET_CHANNEL"

- name: Restore developer tools after the update gate
if: always() && runner.os == 'macOS'
run: bash scripts/ci/macos-developer-tools.sh restore "$RUNNER_TEMP/previous-stable-gate-developer-tools"
29 changes: 27 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1791,7 +1791,7 @@ jobs:
needs.release-metadata.outputs.should_release == 'true' &&
(needs.release-metadata.outputs.mode == 'candidate' || needs.release-metadata.outputs.mode == 'full')
runs-on: ${{ matrix.os }}
timeout-minutes: 15
timeout-minutes: 30
permissions:
actions: read
contents: read
Expand Down Expand Up @@ -1967,6 +1967,21 @@ jobs:
if: always() && matrix.platform == 'macos'
run: bash scripts/ci/macos-developer-tools.sh restore "$RUNNER_TEMP/developer-tools"

# Installed copies update with the updater they shipped. If the latest
# stable's updater refuses this release, users on it are stranded, so
# the release must not be published.
- name: Update the latest stable to this release through its own updater
env:
RELEASE_CHANNEL: ${{ needs.release-metadata.outputs.channel }}
RELEASE_VERSION: ${{ needs.release-metadata.outputs.version }}
run: >-
scripts/ci/previous-stable-update-gate.sh
staged-release "$RELEASE_VERSION" "$GITHUB_SHA" "$RELEASE_CHANNEL"

- name: Restore developer tools after the update gate
if: always() && matrix.platform == 'macos'
run: bash scripts/ci/macos-developer-tools.sh restore "$RUNNER_TEMP/previous-stable-gate-developer-tools"

seal-candidate:
name: Seal stable release candidate
needs:
Expand Down Expand Up @@ -2166,7 +2181,7 @@ jobs:
if: needs.prepare-promotion.result == 'success' && needs.release-metadata.outputs.mode == 'promote'
runs-on: ubuntu-latest
environment: release
timeout-minutes: 10
timeout-minutes: 20
permissions:
actions: read
attestations: write
Expand Down Expand Up @@ -2224,6 +2239,16 @@ jobs:
release-candidate/github-release/SHA256SUMS.txt.sigstore
"$SOURCE_SHA"

# Promotion signs the release again, and users get this signature, not
# the candidate's. The candidate's macOS bundles already passed the
# gate and are unchanged.
- name: Update the latest stable to the promoted release through its own updater
env:
RELEASE_VERSION: ${{ needs.release-metadata.outputs.version }}
run: >-
scripts/ci/previous-stable-update-gate.sh
release-candidate/github-release "$RELEASE_VERSION" "$SOURCE_SHA" stable

- name: Upload promotion-time GitHub assets
id: github-assets
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
Expand Down
Loading
Loading