-
Notifications
You must be signed in to change notification settings - Fork 388
73 lines (62 loc) · 1.91 KB
/
publish-ghcr-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
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
name: Publish multiarch images on ghcr.io
on:
push:
tags:
- '*'
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
publish:
name: Build and push Spilo multiarch images
runs-on: ubuntu-latest
permissions:
contents: 'read'
packages: 'write'
defaults:
run:
shell: bash
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.7
- name: Install flake8 and docker-compose
run: python -m pip install flake8 docker-compose==1.17.1
- name: Derive spilo image name
id: image
working-directory: postgres-appliance
run: |
PGVERSION=$(sed -n 's/^ARG PGVERSION=\([1-9][0-9]*\).*$/\1/p' Dockerfile)
IMAGE="${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-$PGVERSION:${GITHUB_REF/refs\/tags\//}"
echo "NAME=$IMAGE" >> $GITHUB_OUTPUT
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to GHCR
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and export to local docker for testing
uses: docker/build-push-action@v3
with:
context: "postgres-appliance/"
load: true
tags: ${{ steps.image.outputs.NAME }}
- name: Test spilo docker image
env:
SPILO_TEST_IMAGE: "${{ steps.image.outputs.NAME }}"
run: |
bash postgres-appliance/tests/test_spilo.sh
- name: Build arm64 additionaly and push multiarch image to ghcr
uses: docker/build-push-action@v3
with:
context: "postgres-appliance/"
push: true
tags: "${{ steps.image.outputs.NAME }}"
platforms: linux/amd64,linux/arm64