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

Commit 6e6bfac

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 Signed-off-by: Chris Privitere <[email protected]>
1 parent 570f391 commit 6e6bfac

File tree

1 file changed

+51
-51
lines changed

1 file changed

+51
-51
lines changed

.github/workflows/release.yaml

Lines changed: 51 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -9,36 +9,29 @@ 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+
REGISTRY: ${{ env.QUAY_REGISTRY }}
13+
1514
jobs:
16-
manager-image:
17-
name: Build and push manager image
15+
16+
build-image:
17+
name: Build and Push Image
1818
runs-on: ubuntu-latest
19+
20+
permissions:
21+
packages: write # needed to push docker image to ghcr.io
22+
1923
steps:
20-
- name: Checkout code
24+
25+
- name: Checkout git repo
2126
uses: actions/checkout@v3
22-
with:
23-
fetch-depth: 0
24-
- uses: actions/setup-go@v4
25-
with:
26-
go-version-file: './go.mod'
27+
2728
- name: Set up QEMU
2829
uses: docker/setup-qemu-action@v2
30+
2931
- name: Set up Docker Buildx
3032
uses: docker/setup-buildx-action@v2
3133

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
34+
- name: Login to ghcr.io registry
4235
uses: docker/login-action@v2
4336
with:
4437
registry: ghcr.io
@@ -64,58 +57,64 @@ jobs:
6457
username: ${{ secrets.QUAY_USERNAME }}
6558
password: ${{ secrets.QUAY_PASSWORD }}
6659

60+
- name: Docker meta
61+
id: docker_meta
62+
uses: docker/metadata-action@v4
63+
with:
64+
images: |
65+
${{ env.QUAY_REGISTRY }}/${{ env.IMAGE_NAME }}
66+
${{ env.GHCR_REGISTRY }}/${{ env.IMAGE_NAME }}
67+
${{ env.DOCKER_REGISTRY }}/${{ env.IMAGE_NAME }}
68+
flavor: |
69+
latest=auto
70+
tags: |
71+
type=semver,pattern={{version}}
72+
type=ref,event=branch
73+
type=ref,event=tag
74+
type=ref,event=pr
75+
type=sha
76+
6777
- name: Setup Env
6878
run: |
6979
DOCKER_BUILD_LDFLAGS="$(hack/version.sh)"
7080
echo 'DOCKER_BUILD_LDFLAGS<<EOF' >> $GITHUB_ENV
7181
echo $DOCKER_BUILD_LDFLAGS >> $GITHUB_ENV
7282
echo 'EOF' >> $GITHUB_ENV
7383
74-
- name: Build and push manager image
84+
- name: Docker Build and Push
7585
uses: docker/build-push-action@v4
7686
with:
7787
context: .
7888
push: true
7989
build-args: |
8090
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 }}
91+
tags: ${{ steps.docker_meta.outputs.tags }}
92+
labels: ${{ steps.docker_meta.outpus.labels }}
93+
cache-from: type=gha
94+
cache-to: type=gha,mode=max
95+
platforms: linux/amd64, linux/arm64, linux/arm/v7
96+
97+
outputs:
98+
image-tag: "${{ steps.docker_meta.outputs.version }}"
8699

87100
release:
88-
name: Release
101+
name: Create Release
89102
runs-on: ubuntu-latest
90-
needs:
91-
- manager-image
103+
needs: [build-image]
104+
env:
105+
TAG: ${{ needs.build-image.outputs.image-tag }}
106+
92107
steps:
93-
- name: Checkout code
108+
109+
- name: checkout
94110
uses: actions/checkout@v3
111+
95112
- uses: actions/setup-go@v4
96113
with:
97114
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 }}
114115

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

120119
- name: Generate Release Notes
121120
run: |
@@ -127,11 +126,12 @@ jobs:
127126
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
128127
OWNER: ${{ github.repository_owner }}
129128
REPO: ${{ github.event.repository.name }}
129+
130130
- name: Create Release
131131
uses: softprops/action-gh-release@v1
132132
if: startsWith(github.ref, 'refs/tags/')
133133
with:
134134
files: out/release/*
135135
body: ${{ env.RELEASE_NOTES }}
136136
draft: false
137-
prerelease: false
137+
prerelease: false

0 commit comments

Comments
 (0)