-
Notifications
You must be signed in to change notification settings - Fork 11
41 lines (41 loc) · 1.38 KB
/
ghcr-publish.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
name: Create and publish a Docker image in ghcr.io
on:
push:
tags:
- v?[0-9]+.[0-9]+.[0-9]+*
env:
REGISTRY: ghcr.io
REPOSITORY: ${{ github.repository }}
jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
attestations: write
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@v12
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build fedimint-observer
run: |
nix build -L .#fedimint-observer
- name: Build fedimint-observer image
run: |
nix build -L .#fedimint-observer-image
echo "fedimint_observer_container_tag=$(docker load < result | awk '{ print $3 }')" >> $GITHUB_ENV
- name: Log in to the Container registry
uses: docker/login-action@v3.2.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Tag and push fedimint-observer image to ghcr.io
env:
IMAGE_TAG: ${{ github.sha }}
run: |-
nix_tag=${{ env.fedimint_observer_container_tag }} && hub_tag="$REGISTRY/$REPOSITORY:$IMAGE_TAG" && docker tag "$nix_tag" "$hub_tag" && docker push "$hub_tag"