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
52 changes: 40 additions & 12 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,13 @@ jobs:
outputs:
packages: ${{ steps.plan.outputs.packages }}
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5
with:
fetch-depth: 0
persist-credentials: false
- name: Check incremental cache publication
run: python3 -m unittest discover -s tests
- uses: cachix/install-nix-action@v31
- uses: cachix/install-nix-action@75c75c31ebece974e48ebc36b4ad125bd97bd97b # v31
with:
extra_nix_config: |
experimental-features = nix-command flakes
Expand Down Expand Up @@ -53,40 +54,67 @@ jobs:
if: needs.evaluate.outputs.packages != '[]'
runs-on: ubuntu-24.04-arm
timeout-minutes: 180
permissions:
contents: read
id-token: write
attestations: write
strategy:
fail-fast: false
max-parallel: 2
matrix:
package: ${{ fromJSON(needs.evaluate.outputs.packages) }}
steps:
- uses: actions/checkout@v5
- uses: cachix/install-nix-action@v31
- uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5
with:
persist-credentials: false
- uses: cachix/install-nix-action@75c75c31ebece974e48ebc36b4ad125bd97bd97b # v31
with:
extra_nix_config: |
experimental-features = nix-command flakes
extra-substituters = https://aurorasilicon.org/nixos-aurora/cache
extra-trusted-public-keys = aurora-nixos-1:ZxmPNEWsrzgXai+W+dlTE8cachb1xaatfXKK8X8go14=
- name: Fetch pinned sources with verification and rate-limit backoff
env:
PACKAGE: ${{ matrix.package }}
run: python3 scripts/prefetch-sources.py "$PACKAGE"
- name: Build the pinned Aurora hardware package
run: nix build --max-jobs 1 --cores 4 --print-build-logs --json '.#${{ matrix.package }}^*' > build.json
- name: Record output identity and closure
run: |
mapfile -t outputs < <(jq -r '.[].outputs[]' build.json)
nix path-info --json --recursive "${outputs[@]}" > closure.json
nix store verify --recursive "${outputs[@]}"
- name: Export a signed candidate cache
# Build jobs never see the cache key: the export is unsigned, and the
# publisher signs only metadata it has verified (publish-cache.yml).
- name: Export an unsigned candidate cache
if: github.event_name != 'pull_request'
env:
NIX_CACHE_SIGNING_KEY: ${{ secrets.NIX_CACHE_SIGNING_KEY }}
run: |
mapfile -t outputs < <(jq -r '.[].outputs[]' build.json)
printf '%s' "$NIX_CACHE_SIGNING_KEY" | bash scripts/export-cache /dev/stdin "$PWD/cache" "${outputs[@]}"
nix store verify --store "file://$PWD/cache" --all --sigs-needed 1 \
--trusted-public-keys "$(cat keys/cache.pub)"
- uses: actions/upload-artifact@v4
if: always()
bash scripts/export-cache "$PWD/cache" "${outputs[@]}"
nix store verify --store "file://$PWD/cache" --all --no-trust
- id: upload
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
if: success()
with:
name: nix-${{ matrix.package }}-closure
path: |
build.json
closure.json
cache/
# Provenance for the exact artifact bytes; publication verifies it.
- uses: actions/attest-build-provenance@4d101475d8b20a2381f78447822ac1eab6504dd8 # v4.2.2
if: success() && github.event_name != 'pull_request'
with:
subject-name: nix-${{ matrix.package }}-closure.zip
subject-digest: sha256:${{ steps.upload.outputs.artifact-digest }}
# A failed attempt keeps its log under a name publication never reads, so
# a re-run cannot leave an empty artifact beside the real one.
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
if: failure()
with:
name: failed-nix-${{ matrix.package }}-attempt-${{ github.run_attempt }}
path: |
build.json
closure.json
if-no-files-found: ignore
retention-days: 14
146 changes: 123 additions & 23 deletions .github/workflows/deploy-cache.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,42 +5,142 @@ on:
release-tag:
description: Immutable release with signed NARs and cache-metadata.tar.gz
required: true
permissions:
contents: read
pages: write
id-token: write
advance-testing:
description: Point channel-testing at the release's commit
type: boolean
default: true
allow-downgrade:
description: Allow a source pin to move backwards (rollback); requires stable-promotion approval
type: boolean
default: false
dry-run:
description: Authenticate and assemble only; deploy and record nothing
type: boolean
default: false
workflow_call:
inputs:
release-tag:
type: string
required: true
advance-testing:
type: boolean
default: true
allow-downgrade:
type: boolean
default: false
dry-run:
type: boolean
default: false
permissions: {}
defaults:
run:
shell: bash
concurrency:
group: nix-cache-publication
cancel-in-progress: false
jobs:
deploy:
approve:
if: inputs.allow-downgrade
runs-on: ubuntu-24.04
environment: stable-promotion
permissions: {}
steps:
- run: echo 'Rollback approved.' >> "$GITHUB_STEP_SUMMARY"

assemble:
needs: approve
if: always() && (needs.approve.result == 'success' || needs.approve.result == 'skipped')
runs-on: ubuntu-24.04-arm
environment:
name: github-pages
url: ${{ steps.deploy.outputs.page_url }}
timeout-minutes: 120
permissions:
contents: read
attestations: read
steps:
- uses: actions/checkout@v5
- uses: cachix/install-nix-action@v31
- name: Authenticate every cache entry and NAR
- uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5
with:
fetch-depth: 0
persist-credentials: false
- uses: cachix/install-nix-action@75c75c31ebece974e48ebc36b4ad125bd97bd97b # v31
- name: Authenticate every cache entry and NAR, and the pin history
env:
GH_TOKEN: ${{ github.token }}
RELEASE_TAG: ${{ inputs.release-tag }}
ADVANCE: ${{ inputs.advance-testing }}
ALLOW_DOWNGRADE: ${{ inputs.allow-downgrade }}
run: |
[[ $RELEASE_TAG =~ ^cache-[A-Za-z0-9._-]+$ ]]
gh release download "$RELEASE_TAG" --repo "$GITHUB_REPOSITORY" --pattern cache-metadata.tar.gz --dir snapshot
python3 - <<'PY'
import tarfile
with tarfile.open('snapshot/cache-metadata.tar.gz') as archive:
archive.extractall('site', filter='data')
PY
python3 scripts/verify-published-cache.py --cache-dir site/cache --public-key keys/cache.pub
cp keys/cache.pub site/cache.pub
- uses: actions/configure-pages@v5
- uses: actions/upload-pages-artifact@v3
set -euo pipefail
flags=()
[[ $ADVANCE != true ]] || flags+=(--advance-testing)
[[ $ALLOW_DOWNGRADE != true ]] || flags+=(--allow-downgrade)
python3 scripts/cache-channels.py assemble --tag "$RELEASE_TAG" "${flags[@]}" --site site \
--work "$RUNNER_TEMP/assemble" --state-out channel-state.json | tee -a "$GITHUB_STEP_SUMMARY"
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: channel-state
path: channel-state.json
retention-days: 30
- uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3
if: ${{ !inputs.dry-run }}
with:
path: site

deploy:
needs: assemble
if: always() && needs.assemble.result == 'success' && !inputs.dry-run
runs-on: ubuntu-24.04
environment:
name: github-pages
url: ${{ steps.deploy.outputs.page_url }}
permissions:
pages: write
id-token: write
steps:
- uses: actions/configure-pages@983d7736d9b0ae728b81ab479565c72886d7745b # v5
- id: deploy
uses: actions/deploy-pages@v4
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4

record:
needs: deploy
if: always() && needs.deploy.result == 'success'
runs-on: ubuntu-24.04
permissions:
contents: write
steps:
- uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5
with:
fetch-depth: 0
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
name: channel-state
- env:
GH_TOKEN: ${{ github.token }}
ADVANCE: ${{ inputs.advance-testing }}
run: |
channels=()
[[ $ADVANCE != true ]] || channels=(testing)
python3 scripts/cache-channels.py record --state channel-state.json --channels "${channels[@]}"

images:
# Optional (AUTO_IMAGES=true): rebuild the three images when main is the
# commit testing now serves, so every hardware output is in the cache.
needs: record
if: always() && needs.record.result == 'success' && inputs.advance-testing && vars.AUTO_IMAGES == 'true'
runs-on: ubuntu-24.04
permissions:
actions: write
contents: read
steps:
- env:
GH_TOKEN: ${{ github.token }}
TAG: ${{ inputs.release-tag }}
run: |
set -euo pipefail
commit=$(gh api "repos/$GITHUB_REPOSITORY/releases/tags/$TAG" --jq .target_commitish)
main=$(gh api "repos/$GITHUB_REPOSITORY/commits/main" --jq .sha)
if [[ $commit != "$main" ]]; then
echo "main moved past $commit; images wait for the next cache." >> "$GITHUB_STEP_SUMMARY"
exit 0
fi
for desktop in minimal kde gnome; do
gh workflow run images.yml --repo "$GITHUB_REPOSITORY" --ref main -f desktop="$desktop"
done
24 changes: 20 additions & 4 deletions .github/workflows/images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ on:
type: choice
options: [minimal, kde, gnome]
default: minimal
channel:
description: What /etc/nixos/flake.nix follows (pinned keeps today's exact-commit input)
type: choice
options: [pinned, testing, stable]
default: pinned
permissions:
contents: read
defaults:
Expand All @@ -15,9 +20,15 @@ jobs:
image:
runs-on: ubuntu-24.04-arm
timeout-minutes: 180
permissions:
contents: read
id-token: write
attestations: write
steps:
- uses: actions/checkout@v5
- uses: cachix/install-nix-action@v31
- uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5
with:
persist-credentials: false
- uses: cachix/install-nix-action@75c75c31ebece974e48ebc36b4ad125bd97bd97b # v31
with:
extra_nix_config: |
extra-substituters = https://aurorasilicon.org/nixos-aurora/cache
Expand All @@ -34,11 +45,16 @@ jobs:
- name: Assemble the installer filesystem bundle
env:
DESKTOP: ${{ inputs.desktop }}
AURORA_UPDATE_CHANNEL: ${{ inputs.channel || 'pinned' }}
run: |
sudo apt-get update
sudo apt-get install -y btrfs-progs e2fsprogs dosfstools fdisk zstd
sudo env PATH="$PATH" bash scripts/build-image "$DESKTOP" "$(readlink -f system)" "$(readlink -f installer)" "$(readlink -f aura)" "$(readlink -f grub)" 2>&1 | tee image-build.log
- uses: actions/upload-artifact@v4
sudo env PATH="$PATH" AURORA_UPDATE_CHANNEL="$AURORA_UPDATE_CHANNEL" bash scripts/build-image "$DESKTOP" "$(readlink -f system)" "$(readlink -f installer)" "$(readlink -f aura)" "$(readlink -f grub)" 2>&1 | tee image-build.log
- uses: actions/attest-build-provenance@4d101475d8b20a2381f78447822ac1eab6504dd8 # v4.2.2
if: success()
with:
subject-path: out/*-filesystems.tar.zst
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
if: always()
with:
name: nixos-${{ inputs.desktop }}-candidate
Expand Down
45 changes: 45 additions & 0 deletions .github/workflows/payload-after-images.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Publish a payload after an image build
# Optional: with AUTO_PAYLOADS=true, every successful main image build gets a
# signed installer payload release. Adopting it into the installer catalogs
# stays a separate, deliberate step in aurora-distributions.
on:
workflow_run:
workflows: [Native Aurora NixOS images]
types: [completed]
branches: [main]
permissions: {}
jobs:
profile:
if: vars.AUTO_PAYLOADS == 'true' && github.event.workflow_run.conclusion == 'success'
runs-on: ubuntu-24.04
permissions:
actions: read
outputs:
profile: ${{ steps.profile.outputs.profile }}
steps:
- id: profile
env:
GH_TOKEN: ${{ github.token }}
RUN: ${{ github.event.workflow_run.id }}
run: |
set -euo pipefail
profile=$(gh api "repos/$GITHUB_REPOSITORY/actions/runs/$RUN/artifacts" \
--jq '[.artifacts[].name | select(endswith("-candidate"))] | first | rtrimstr("-candidate")')
[[ $profile =~ ^nixos-(kde|gnome|minimal)$ ]]
echo "profile=$profile" >> "$GITHUB_OUTPUT"

payload:
needs: profile
permissions:
contents: write
actions: read
id-token: write
attestations: write
uses: aurora-silicon/aurora-distributions/.github/workflows/build-payload.yml@2225014a2b2bb2c1e4f4d26c245232c1d8491fed
with:
profile: ${{ needs.profile.outputs.profile }}
image-run: ${{ github.event.workflow_run.id }}
# The catalog key comes from this repository's catalog-signing
# environment, which the reusable workflow's signing job runs in.
secrets:
INSTALLER_CATALOG_SIGNING_KEY: ${{ secrets.INSTALLER_CATALOG_SIGNING_KEY }}
Loading
Loading