-
Notifications
You must be signed in to change notification settings - Fork 10
59 lines (50 loc) · 1.53 KB
/
build.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
name: Docker Image CI/CD for timescale + postgis image
on:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
id-token: write
strategy:
matrix:
dockerfile:
[
"Dockerfile.pg13-ts2.12",
"Dockerfile.pg14-ts2.12",
"Dockerfile.pg15-ts2.12",
"Dockerfile.pg16-ts2.13",
"Dockerfile.pg17-ts2.17",
]
steps:
- name: Checkout sources
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
with:
platforms: linux/amd64,linux/arm64
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract version from Dockerfile name
id: extract_version
run: |
version="${{ matrix.dockerfile }}"
version="${version#Dockerfile.}" # Remove "Dockerfile." prefix if it exists
echo "::set-output name=version::${version}"
shell: bash
- name: Build and Publish
uses: docker/build-push-action@v4
with:
file: ${{ matrix.dockerfile }}
platforms: linux/amd64
push: true
tags: ghcr.io/${{ github.repository }}:${{ steps.extract_version.outputs.version }}