-
Notifications
You must be signed in to change notification settings - Fork 4
66 lines (59 loc) · 1.84 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
60
61
62
63
64
65
66
name: Build Image
on:
workflow_dispatch:
inputs:
extra_tag:
description: "Image will be tagged as `dev-<gh_run_id>` (e.g dev-1234). With this field you can set an extra tag"
required: false
default: ""
pg_repo:
description: "Name of the target PG repository"
required: true
default: "https://git.postgresql.org/git/postgresql.git"
pg_branch:
description: "Name of the branch in the target PG repository"
required: true
default: "master"
# set up environment variables to be used across all the jobs
env:
REGISTRY: "ghcr.io/cloudnative-pg/postgresql-trunk"
TAG: "dev-${{ github.run_number }}"
defaults:
run:
# default failure handling for shell scripts in 'run' steps
shell: 'bash -Eeuo pipefail -x {0}'
jobs:
build-pg:
name: Build the Trunk of PostgreSQL
runs-on: ubuntu-22.04
permissions:
contents: read
packages: write
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Set optional extra tag
run: |
EXTRA_TAG=""
if [[ "${{ github.event.inputs.extra_tag }}" != "" ]]; then
EXTRA_TAG="${{ env.REGISTRY }}:${{ github.event.inputs.extra_tag }}"
fi
echo "EXTRA_TAG=${EXTRA_TAG}" >> $GITHUB_ENV
- name: Log in to the GitHub Container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
push: true
load: false
tags: |
${{ env.REGISTRY }}:${{ env.TAG }}
${{ env.EXTRA_TAG }}
build-args: |
PG_REPO=${{ github.event.inputs.pg_repo }}
PG_BRANCH=${{ github.event.inputs.pg_branch }}