-
Notifications
You must be signed in to change notification settings - Fork 4
46 lines (43 loc) · 1.63 KB
/
Container.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
name: Container
on:
- push
env:
REGISTRY: ghcr.io
IMAGE_NAME: softvare-group/ddnnife
TAG: ${{ github.ref_name }}
jobs:
Build:
strategy:
matrix:
target:
- double: aarch64-linux # target we are building for
architecture: arm64 # container architecture label
runner: ubuntu-24.04-arm # GitHub runner the build is running on
- double: x86_64-linux
architecture: amd64
runner: ubuntu-24.04
runs-on: ${{ matrix.target.runner }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Nix
uses: cachix/install-nix-action@v30
- name: Cache
uses: cachix/cachix-action@v15
with:
name: softvare-group
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
- name: Build
run: nix build -L .#container
- name: Container policy
run: |
nix build --out-link skopeo nixpkgs#skopeo
mkdir -p $HOME/.config/containers
cp skopeo/etc/containers/default-policy.json $HOME/.config/containers/policy.json
- name: Login
run: nix run nixpkgs#skopeo -- login $REGISTRY --username ${{ github.actor }} --password ${{ secrets.GITHUB_TOKEN }}
- name: Push
run: nix run nixpkgs#skopeo -- copy docker-archive:result docker://$REGISTRY/$IMAGE_NAME:$TAG-${{ matrix.target.architecture }}
- name: Push latest tag
if: ${{ github.ref_type == 'tag' }}
run: nix run nixpkgs#skopeo -- copy docker://$REGISTRY/$IMAGE_NAME:$TAG-${{ matrix.target.architecture }} docker://$REGISTRY/$IMAGE_NAME:latest-${{ matrix.target.architecture }}