Skip to content
This repository was archived by the owner on Aug 12, 2025. It is now read-only.

Commit 1f86422

Browse files
committed
ci: refactor release CI
- remove caching - Add tags like we have in main ci - Publish for arm/v7 - remove custom metadata action - Fix registry variable Signed-off-by: Chris Privitere <[email protected]>
1 parent 570f391 commit 1f86422

File tree

2 files changed

+52
-53
lines changed

2 files changed

+52
-53
lines changed

.github/workflows/ci.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ env:
1414
GHCR_REGISTRY: ghcr.io/${{ github.repository_owner }}
1515
DOCKER_REGISTRY: ${{ secrets.DOCKER_ORG }}
1616
QUAY_REGISTRY: quay.io/${{ secrets.QUAY_ORG }}
17-
REGISTRY: ${{ env.QUAY_REGISTRY }}
17+
REGISTRY: $QUAY_REGISTRY
1818

1919
jobs:
2020
validate:
@@ -111,7 +111,7 @@ jobs:
111111
context: .
112112
push: true
113113
tags: ${{ steps.docker_meta.outputs.tags }}
114-
labels: ${{ steps.docker_meta.outpus.labels }}
114+
labels: ${{ steps.docker_meta.outputs.labels }}
115115
cache-from: type=gha
116116
cache-to: type=gha,mode=max
117117
platforms: linux/amd64, linux/arm64, linux/arm/v7

.github/workflows/release.yaml

Lines changed: 50 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -9,36 +9,28 @@ env:
99
GHCR_REGISTRY: ghcr.io/${{ github.repository_owner }}
1010
DOCKER_REGISTRY: ${{ secrets.DOCKER_ORG }}
1111
QUAY_REGISTRY: quay.io/${{ secrets.QUAY_ORG }}
12-
REGISTRY: quay.io/${{ secrets.QUAY_ORG }}
13-
metadata_flavor: latest=false
14-
metadata_tags: type=ref,event=tag
12+
1513
jobs:
16-
manager-image:
17-
name: Build and push manager image
14+
15+
build-image:
16+
name: Build and Push Image
1817
runs-on: ubuntu-latest
18+
19+
permissions:
20+
packages: write # needed to push docker image to ghcr.io
21+
1922
steps:
20-
- name: Checkout code
23+
24+
- name: Checkout git repo
2125
uses: actions/checkout@v3
22-
with:
23-
fetch-depth: 0
24-
- uses: actions/setup-go@v4
25-
with:
26-
go-version-file: './go.mod'
26+
2727
- name: Set up QEMU
2828
uses: docker/setup-qemu-action@v2
29+
2930
- name: Set up Docker Buildx
3031
uses: docker/setup-buildx-action@v2
3132

32-
- name: Generate metadata
33-
id: meta
34-
uses: ./.github/actions/metadata
35-
with:
36-
docker_username: ${{ secrets.DOCKER_USERNAME }}
37-
quay_username: ${{ secrets.QUAY_USERNAME }}
38-
metadata_flavor: ${{ env.metadata_flavor }}
39-
metadata_tags: ${{ env.metadata_tags }}
40-
41-
- name: Log in to ghcr.io
33+
- name: Login to ghcr.io registry
4234
uses: docker/login-action@v2
4335
with:
4436
registry: ghcr.io
@@ -64,58 +56,64 @@ jobs:
6456
username: ${{ secrets.QUAY_USERNAME }}
6557
password: ${{ secrets.QUAY_PASSWORD }}
6658

59+
- name: Docker meta
60+
id: docker_meta
61+
uses: docker/metadata-action@v4
62+
with:
63+
images: |
64+
${{ env.QUAY_REGISTRY }}/${{ env.IMAGE_NAME }}
65+
${{ env.GHCR_REGISTRY }}/${{ env.IMAGE_NAME }}
66+
${{ env.DOCKER_REGISTRY }}/${{ env.IMAGE_NAME }}
67+
flavor: |
68+
latest=auto
69+
tags: |
70+
type=semver,pattern={{version}}
71+
type=ref,event=branch
72+
type=ref,event=tag
73+
type=ref,event=pr
74+
type=sha
75+
6776
- name: Setup Env
6877
run: |
6978
DOCKER_BUILD_LDFLAGS="$(hack/version.sh)"
7079
echo 'DOCKER_BUILD_LDFLAGS<<EOF' >> $GITHUB_ENV
7180
echo $DOCKER_BUILD_LDFLAGS >> $GITHUB_ENV
7281
echo 'EOF' >> $GITHUB_ENV
7382
74-
- name: Build and push manager image
83+
- name: Docker Build and Push
7584
uses: docker/build-push-action@v4
7685
with:
7786
context: .
7887
push: true
7988
build-args: |
8089
LDFLAGS=${{ env.DOCKER_BUILD_LDFLAGS }}
81-
tags: ${{ steps.meta.outputs.tags }}
82-
labels: ${{ steps.meta.outputs.labels }}
83-
platforms: linux/amd64,linux/arm64
84-
cache-from: type=gha, scope=${{ github.workflow }}
85-
cache-to: type=gha, mode=max, scope=${{ github.workflow }}
90+
tags: ${{ steps.docker_meta.outputs.tags }}
91+
labels: ${{ steps.docker_meta.outputs.labels }}
92+
cache-from: type=gha
93+
cache-to: type=gha,mode=max
94+
platforms: linux/amd64, linux/arm64, linux/arm/v7
95+
96+
outputs:
97+
image-tag: "${{ steps.docker_meta.outputs.version }}"
8698

8799
release:
88-
name: Release
100+
name: Create Release
89101
runs-on: ubuntu-latest
90-
needs:
91-
- manager-image
102+
needs: [build-image]
103+
env:
104+
TAG: ${{ needs.build-image.outputs.image-tag }}
105+
92106
steps:
93-
- name: Checkout code
107+
108+
- name: checkout
94109
uses: actions/checkout@v3
110+
95111
- uses: actions/setup-go@v4
96112
with:
97113
go-version-file: './go.mod'
98-
- uses: actions/cache@v3
99-
with:
100-
path: hack/tools/bin
101-
key: ${{ runner.os }}-tools-bin-release-${{ hashFiles('Makefile') }}
102-
restore-keys: |
103-
${{ runner.os }}-tools-bin-release-
104-
${{ runner.os }}-tools-bin-
105-
106-
- name: Generate metadata
107-
id: meta
108-
uses: ./.github/actions/metadata
109-
with:
110-
docker_username: ${{ secrets.DOCKER_USERNAME }}
111-
quay_username: ${{ secrets.QUAY_USERNAME }}
112-
metadata_flavor: ${{ env.metadata_flavor }}
113-
metadata_tags: ${{ env.metadata_tags }}
114114

115-
- name: manifest
115+
- name: Make Release
116116
run: make release
117-
env:
118-
TAG: ${{ steps.meta.outputs.version }}
119117

120118
- name: Generate Release Notes
121119
run: |
@@ -127,11 +125,12 @@ jobs:
127125
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
128126
OWNER: ${{ github.repository_owner }}
129127
REPO: ${{ github.event.repository.name }}
128+
130129
- name: Create Release
131130
uses: softprops/action-gh-release@v1
132131
if: startsWith(github.ref, 'refs/tags/')
133132
with:
134133
files: out/release/*
135134
body: ${{ env.RELEASE_NOTES }}
136135
draft: false
137-
prerelease: false
136+
prerelease: false

0 commit comments

Comments
 (0)