-
Notifications
You must be signed in to change notification settings - Fork 0
92 lines (75 loc) · 2.34 KB
/
publish.yml
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
name: Publish
on:
push:
branches:
- main
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
push:
name: push container
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
outputs:
image: ${{ steps.push.outputs.image }}
steps:
- uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@v14
- uses: DeterminateSystems/magic-nix-cache-action@v8
- uses: nixbuild/nixbuild-action@v19
with:
nixbuild_token: ${{ secrets.NIXBUILD_TOKEN }}
generate_summary_for: 'workflow'
- name: Log into the container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: build and load container
run: |
STORE_PATH="$(
nix build \
--json \
--print-build-logs \
--builders "" \
--max-jobs 2 \
--eval-store auto \
--store ssh-ng://eu.nixbuild.net \
--system x86_64-linux \
.#container | \
jq -r '.[0].outputs.out'
)"
nix copy \
--from ssh-ng://eu.nixbuild.net \
--substitute-on-destination \
"$STORE_PATH"
"$STORE_PATH" | docker load
- name: push container
id: push
run: |
REPO="$(docker images --format json | grep elo-anything | jq -r ".Repository" | head -n 1)"
TAG="$(docker images --format json | grep elo-anything | jq -r ".Tag" | head -n 1)"
SOURCE_NAME="$REPO:$TAG"
FINAL_NAME="$REGISTRY/$IMAGE_NAME:$TAG"
echo "$SOURCE_NAME -> $FINAL_NAME"
docker tag "$SOURCE_NAME" "$FINAL_NAME"
docker push "$FINAL_NAME"
echo "image=$FINAL_NAME" >> "$GITHUB_OUTPUT"
publish:
name: publish manifest
runs-on: ubuntu-latest
environment: production
needs: push
steps:
- uses: actions/checkout@v4
with:
repository: bytes-zone/infrastructure.v3
ref: main
ssh-key: ${{ secrets.DEPLOY_KEY }}
- name: update manifest
run: |
./update-job-image-gha.sh elo-anything ${{ needs.push.outputs.image }}