-
Notifications
You must be signed in to change notification settings - Fork 161
86 lines (73 loc) · 2.93 KB
/
release-ghcr.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
name: Push Image to ghcr.io
on:
release:
types:
- published
push:
tags:
- '**'
workflow_dispatch: {}
env:
REGISTRY: ghcr.io
jobs:
build:
name: "Upload to ghcr.io"
runs-on: ubuntu-latest
steps:
- name: Install Nix with good defaults
uses: input-output-hk/install-nix-action@v21
with:
extra_nix_config: |
trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ=
substituters = https://cache.iog.io/ https://cache.nixos.org/
experimental-features = nix-command flakes fetch-closure
allow-import-from-derivation = true
accept-flake-config = true
nix_path: nixpkgs=channel:nixos-unstable
# cardano-parts requires nix >= 2.17.0; We can remove this after the next release
# to install-nix-action (v23)
install_url: https://releases.nixos.org/nix/nix-2.17.0/install
- name: Checkout repository
uses: actions/checkout@v3
- name: Log in to ghcr.io
uses: docker/[email protected]
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set environment variables
run: |
# Downcase the package repository, because docker reference
# are required to be lower case
REPO_OWNER="$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]')"
IMAGE_TAG="$(echo $GITHUB_REF_NAME | tr '/' '_')"
echo "REPO_OWNER=${REPO_OWNER}" >> "$GITHUB_ENV"
echo "IMAGE_TAG=${IMAGE_TAG}" >> "$GITHUB_ENV"
- name: Upload ${{ github.actor }}/cardano-db-sync
run: |
# Download the image from the nix binary cachhe
nix build --builders "" --max-jobs 0 .#cardano-db-sync-docker
# Push the image
skopeo copy \
docker-archive:./result \
docker://ghcr.io/${REPO_OWNER}/cardano-db-sync:$IMAGE_TAG
# If it's a tag build, also tag it as latest
if [[ "$GITHUB_REF_TYPE" = "tag" ]]; then
skopeo copy \
docker-archive:./result \
docker://ghcr.io/${REPO_OWNER}/cardano-db-sync:latest
fi
- name: Upload ${{ github.actor }}/cardano-smash-server
run: |
# Download the image from the nix binary cachhe
nix build --builders "" --max-jobs 0 .#cardano-smash-server-docker
# Push the image
skopeo copy \
docker-archive:./result \
docker://ghcr.io/${REPO_OWNER}/cardano-smash-server:$IMAGE_TAG
# If it's a tag build, also tag it as latest
if [[ "$GITHUB_REF_TYPE" = "tag" ]]; then
skopeo copy \
docker-archive:./result \
docker://ghcr.io/${REPO_OWNER}/cardano-smash-server:latest
fi