-
Notifications
You must be signed in to change notification settings - Fork 1
59 lines (44 loc) · 1.59 KB
/
Copy pathnix.yaml
File metadata and controls
59 lines (44 loc) · 1.59 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
name: "CI"
on:
push:
branches:
- "main"
pull_request:
types: [opened, synchronize, reopened, closed]
branches:
- "main"
workflow_dispatch:
permissions:
contents: write
pull-requests: write
issues: read
packages: write
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [x86_64-linux]
system: [x86_64-linux]
arch: [amd64]
steps:
- uses: actions/checkout@v4
- name: Build all flake outputs
run: om ci
- name: Build And Push Docker image
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
env:
DOCKER_REGISTRY: ghcr.io
run: |
nix build .#packages.${{ matrix.system }}.dockerImage
BASE_IMAGE="$(nix eval --raw .#packages.${{ matrix.system }}.dockerImage.imageName):$(nix eval --raw .#packages.${{ matrix.system }}.dockerImage.imageTag)"
echo "BASE_IMAGE=${BASE_IMAGE}"
mkdir -p /tmp/docker-image
echo "Extracting image to /tmp/docker-image/image.tar"
gunzip -c ./result > /tmp/docker-image/image.tar || cp ./result /tmp/docker-image/image.tar
echo "${{ secrets.GITHUB_TOKEN }}" | crane auth login ${DOCKER_REGISTRY} -u "${{ github.actor }}" --password-stdin
echo "Pushing image to ${BASE_IMAGE}"
crane push /tmp/docker-image/image.tar "${BASE_IMAGE}"
rm -rf /tmp/docker-image
crane auth logout ${DOCKER_REGISTRY}
echo "Push complete"