-
Notifications
You must be signed in to change notification settings - Fork 0
49 lines (48 loc) · 1.82 KB
/
demo.yaml
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
name: Build Container Image
run-name: nix-build
on:
push:
branches: [main]
pull_request:
branches: ['**']
jobs:
Build-Container-Image:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v3
- name: Install Nix
uses: cachix/install-nix-action@v23
with:
nix_path: nixpkgs=channel:nixos-23.11
- name: Nix Cache
uses: DeterminateSystems/magic-nix-cache-action@main
- name: Build manifests
run: nix build .#ociImages
- name: Push to registry
if: ${{ github.ref == 'refs/heads/main' }}
env:
ACTOR: "${{ github.actor }}"
BASE_URL: "ghcr.io/pythoner6"
TOKEN: "${{ secrets.GITHUB_TOKEN }}"
shell: nix develop .#push -c bash {0}
run: |
set -euo pipefail
ACTOR=${ACTOR,,}
source tools/scripts/oci_helpers.sh
crane auth login -u "$ACTOR" --password-stdin <<< "$TOKEN" "ghcr.io"
readarray -t images <<< "$(find result/images -maxdepth 1 -mindepth 1 -type d)"
for image in "${images[@]}"; do
crane push "$image" "$BASE_URL/netserv/$(basename $image):latest"
done
readarray -t charts <<< "$(find result/charts -maxdepth 1 -mindepth 1 -type d)"
for chart in "${charts[@]}"; do
crane push "$chart" "$BASE_URL/charts/$(get_chart_name "$chart"):$(get_chart_version "$chart")"
done
readarray -t apps <<< "$(find result/apps -maxdepth 1 -mindepth 1 -type d)"
for app in "${apps[@]}"; do
if [[ "$app" != "root" ]]; then
crane push "$app" "$BASE_URL/netserv/$(get_chart_name "$app")"
fi
done
crane push "result/apps/root" "$BASE_URL/netserv/$(get_chart_name "result/apps/root")"