-
Notifications
You must be signed in to change notification settings - Fork 4
104 lines (91 loc) · 3.72 KB
/
publish-release.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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
name: Create Release and Push to Container Registries
on:
push:
tags:
- 'v*.*.*'
workflow_dispatch:
inputs:
tag:
description: The tag to publish
required: true
jobs:
publish-image:
name: Build and Push to Docker Hub
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2
with:
persist-credentials: false
if: github.event_name == 'push'
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2
with:
persist-credentials: false
ref: refs/tags/${{ github.event.inputs.tag }}
if: github.event_name == 'workflow_dispatch'
- run: |
echo REPOSITORY="$(
echo "${GITHUB_REPOSITORY}" |
tr '[:upper:]' '[:lower:]' |
sed 's/docker-//'
)" >"${GITHUB_ENV}"
- uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 #v3.3.0
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 #v3.3.0
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- id: meta
uses: docker/metadata-action@369eb591f429131d6889c46b94e711f089e6ca96 #v5.6.1
with:
images: |
${{ env.REPOSITORY }}
ghcr.io/${{ env.REPOSITORY }}
# generate Docker tags based on the following events/attributes
tags: |
type=schedule
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
- uses: docker/setup-qemu-action@53851d14592bedcffcf25ea515637cff71ef929a #v3.3.0
- uses: docker/setup-buildx-action@6524bf65af31da8d45b59e8c27de4bd072b392f5 #v3.8.0
- id: package-versions
run: echo "data=$(cat package-versions.json)" >> $GITHUB_OUTPUT
- id: docker_build
uses: docker/build-push-action@ca877d9245402d1537745e0e356eab47c3520991 #v6.13.0
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
annotations: ${{ steps.meta.outputs.annotations }}
build-args: |
ALPINE_VERSION=${{ fromJSON(steps.package-versions.outputs.data).alpine.version }}
PGTAP_VERSION=${{ fromJSON(steps.package-versions.outputs.data).pgtap.version }}
PG_PROVE_VERSION=${{ fromJSON(steps.package-versions.outputs.data).pg_prove.version }}
SQITCH_VERSION=${{ fromJSON(steps.package-versions.outputs.data).sqitch.version }}
__DOCKERFILE_VERSION__=${{ fromJSON(steps.package-versions.outputs.data).VERSION }}
__DOCKERFILE_DATE__=${{ fromJSON(steps.package-versions.outputs.data).DATE }}
platforms: |
linux/amd64
linux/arm64
linux/arm/v7
cache-from: type=gha
cache-to: type=gha,mode=max
- uses: ghalactic/github-release-from-tag@cebdacac0ccd08933b8e7f278f4123723ad978eb #v5.4.0
with:
summaryEnabled: false
- uses: peter-evans/dockerhub-description@e98e4d1628a5f3be2be7c231e50981aee98723ae #v4.0.0
with:
repository: kineticcafe/${{ env.REPOSITORY }}
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Image digest
run: echo "${DIGEST}"
with:
DIGEST: ${{ steps.docker_build.outputs.digest }}