-
Notifications
You must be signed in to change notification settings - Fork 0
64 lines (53 loc) · 1.62 KB
/
ci.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
name: CI
on:
push:
workflow_dispatch:
release:
types: [published]
schedule:
- cron: "0 0 * * MON"
permissions:
contents: read
packages: write
# Cancel existing executions when new commits are pushed onto the branch
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
check:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4.0.0
- uses: DeterminateSystems/nix-installer-action@v4
- uses: DeterminateSystems/magic-nix-cache-action@v2
- run: nix flake check
publish:
runs-on: ubuntu-22.04
needs: check
if: ${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/') }}
permissions:
packages: write
steps:
- uses: actions/checkout@v4.0.0
- uses: DeterminateSystems/nix-installer-action@v4
- uses: DeterminateSystems/magic-nix-cache-action@v2
- uses: docker/login-action@e92390c5fb421da1463c202d546fed0ec5c39f20 # v3.1.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# NOTE: Defines ${DOCKER_METADATA_OUTPUT_TAGS}
- uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 # v5.5.1
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- run: |
nix build .#dockerImage
./result | docker load
for TAG in ${DOCKER_METADATA_OUTPUT_TAGS}
do
docker tag zap-it:latest ${TAG}
docker push ${TAG}
done