-
Notifications
You must be signed in to change notification settings - Fork 0
59 lines (53 loc) · 1.75 KB
/
containers.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
name: build and push container to registry
on:
workflow_dispatch:
inputs:
image_name:
type: string
description: the package to use for `nix build`
repository_name:
type: string
description: the container registry name
workflow_call:
inputs:
image_name:
type: string
description: the package to use for `nix build`
repository_name:
type: string
description: the container registry name
jobs:
publish-container:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v3
- name: Install nix
uses: DeterminateSystems/nix-installer-action@v2
with:
logger: pretty
log-directives: nix_installer=trace
backtrace: full
github-token: ${{ secrets.GITHUB_TOKEN }}
extra-conf: |
extra-substituters = https://cache.garnix.io
extra-trusted-public-keys = cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g=
system-features = kvm
- name: build image
env:
PACKAGE_NAME: ${{ inputs.image_name }}
run: nix build .#${PACKAGE_NAME}
- name: login to registry
env:
USERNAME: ${{ github.actor }}
PASSWORD: ${{ secrets.GITHUB_TOKEN }}
run: echo ${PASSWORD} | nix develop -c skopeo login ghcr.io -u ${USERNAME} --password-stdin
- name: push to registry
env:
REPO_OWNER: justinrubek
REPO_NAME: ${{ inputs.repository_name }}
VERSION: ${{ github.sha }}
PACKAGE_NAME: ${{ inputs.image_name }}
run: nix run .#${PACKAGE_NAME}.copyTo docker://ghcr.io/${REPO_OWNER}/${REPO_NAME}:${VERSION}