Skip to content

Commit 9a083c9

Browse files
committed
build master, and formally tag on releases
1 parent aeffd85 commit 9a083c9

File tree

1 file changed

+28
-15
lines changed

1 file changed

+28
-15
lines changed

.github/workflows/release.yml

Lines changed: 28 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@ name: Publish Operator
22

33
on:
44
release:
5-
types: [published]
5+
types:
6+
- published
7+
8+
push:
9+
branches:
10+
- 'master'
611

712
permissions:
813
contents: read
@@ -11,41 +16,49 @@ jobs:
1116
build:
1217
runs-on: ubuntu-latest
1318
steps:
14-
- uses: actions/checkout@v3
15-
16-
- name: Generate Docker Tag
17-
run: |
18-
echo ${{ github.ref }} | cut -d '/' -f 3 > DOCKER_TAG
19-
echo "DOCKER_TAG=$(cat DOCKER_TAG)" >> $GITHUB_ENV
19+
- name: Checkout
20+
uses: actions/checkout@v4
2021

2122
- name: Set up QEMU
2223
uses: docker/setup-qemu-action@v2
2324

2425
- name: Set up Docker Buildx
25-
uses: docker/setup-buildx-action@v2
26+
uses: docker/setup-buildx-action@v3
2627

2728
- name: Login to Docker Hub
28-
uses: docker/login-action@v2
29+
uses: docker/login-action@v3
30+
if: ${{ github.repository_owner == 'movetokube' }}
2931
with:
3032
username: ${{ secrets.DOCKER_USER }}
3133
password: ${{ secrets.DOCKER_TOKEN }}
3234

3335
- name: Login to GitHub Container Registry
34-
uses: docker/login-action@v2
36+
uses: docker/login-action@v3
3537
with:
3638
registry: ghcr.io
3739
username: ${{ github.repository_owner }}
3840
password: ${{ secrets.GITHUB_TOKEN }}
3941

42+
- name: Extract metadata (tags, labels) for Docker
43+
id: meta
44+
uses: docker/metadata-action@v5
45+
with:
46+
tags: |
47+
type=raw,value=latest,enable={{!is_default_branch}}
48+
type=semver,pattern=v{{version}}
49+
type=semver,pattern=v{{major}}
50+
type=semver,pattern=v{{major}}.{{minor}}
51+
type=ref,event=branch
52+
images: |
53+
name=movetokube/postgres-operator,enable=${{ github.repository_owner == 'movetokube' }}
54+
name=ghcr.io/${{ github.repository }}
55+
4056
- name: Build and push
4157
uses: docker/build-push-action@v4
4258
with:
4359
context: .
4460
file: ./build/Dockerfile.dist
4561
platforms: linux/amd64,linux/arm64
4662
push: true
47-
tags: |
48-
ghcr.io/movetokube/postgres-operator:latest
49-
ghcr.io/movetokube/postgres-operator:${{ env.DOCKER_TAG }}
50-
movetokube/postgres-operator:${{ env.DOCKER_TAG }}
51-
movetokube/postgres-operator:latest
63+
tags: ${{ steps.meta.outputs.tags }}
64+
labels: ${{ steps.meta.outputs.labels }}

0 commit comments

Comments
 (0)