-
-
Notifications
You must be signed in to change notification settings - Fork 6
97 lines (93 loc) · 3.7 KB
/
Copy pathbuild-base.yaml
File metadata and controls
97 lines (93 loc) · 3.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
name: build-base
on:
workflow_dispatch:
pull_request:
paths:
- flake.lock
- .github/workflows/build-base.yaml
branches:
- develop
- main
push:
paths:
- flake.lock
- .github/workflows/build-base.yaml
tags:
- v*
branches:
- develop
- main
jobs:
build:
# aarch64-linux: self-hosted runner with native build
# x86_64-linux: GitHub-hosted runner
runs-on: ${{ matrix.nix_system == 'aarch64-linux' && fromJSON('["self-hosted", "Linux", "ARM64"]') || 'ubuntu-24.04' }}
strategy:
fail-fast: false
matrix:
nix_system:
- "x86_64-linux"
- "aarch64-linux"
nix_channel:
- "nixos-unstable"
- "nixos-25.11"
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Set up PATH for NixOS (self-hosted)
if: matrix.nix_system == 'aarch64-linux'
run: echo "/run/current-system/sw/bin" >> $GITHUB_PATH
- name: Set up QEMU
if: matrix.nix_system != 'aarch64-linux'
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- uses: cachix/install-nix-action@4e002c8ec80594ecd40e759629461e26c8abed15 # v31
if: matrix.nix_system != 'aarch64-linux'
with:
nix_path: nixpkgs=channel:${{matrix.nix_channel}}
extra_nix_config: |
filter-syscalls = false
experimental-features = nix-command flakes
extra-platforms = aarch64-linux
- uses: DeterminateSystems/flakehub-cache-action@main
- name: Nix Build Base Images
run: |
nix build '.#packages.${{matrix.nix_system}}.base-devcontainer."${{matrix.nix_channel}}"'
- name: Login to Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Load to local registry and retag
if: ${{ github.event.pull_request.base.repo.url == github.event.pull_request.head.repo.url }}
run: |
export derivation_name=$(nix derivation show '.#packages.${{matrix.nix_system}}.base-devcontainer."${{matrix.nix_channel}}"' | nix run nixpkgs#jq -- '(.derivations // . ) | to_entries | .[0].value.outputs.out.path' -r | sed 's/^/\/nix\/store\//; s/^\/nix\/store\/\/nix\/store\//\/nix\/store\//')
export tag=$(cat $derivation_name | docker load | awk '{print $3}')
docker tag $tag ghcr.io/lucernae/devcontainer-nix:base--${{matrix.nix_channel}}---${{matrix.nix_system}}
docker push ghcr.io/lucernae/devcontainer-nix:base--${{matrix.nix_channel}}---${{matrix.nix_system}}
manifests-create:
runs-on: ubuntu-latest
if: ${{ github.event.pull_request.base.repo.url == github.event.pull_request.head.repo.url }}
strategy:
fail-fast: false
matrix:
nix_channel:
- "nixos-unstable"
- "nixos-25.11"
needs:
- build
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Login to Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Create manifests
run: |
docker manifest create ghcr.io/lucernae/devcontainer-nix:base--${{matrix.nix_channel}} \
--amend ghcr.io/lucernae/devcontainer-nix:base--${{matrix.nix_channel}}---x86_64-linux \
--amend ghcr.io/lucernae/devcontainer-nix:base--${{matrix.nix_channel}}---aarch64-linux
docker manifest push ghcr.io/lucernae/devcontainer-nix:base--${{matrix.nix_channel}}