Skip to content

Commit 2333033

Browse files
committed
ci: separate build and release workflows
1 parent 6c1c91d commit 2333033

File tree

2 files changed

+83
-10
lines changed

2 files changed

+83
-10
lines changed

.github/workflows/build.yml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# .github/workflows/release.yml
2+
name: build
3+
4+
on:
5+
pull_request:
6+
push:
7+
tags:
8+
- v[0-9]+.*
9+
10+
permissions:
11+
contents: write
12+
13+
jobs:
14+
build:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
20+
- name: Set ENV
21+
run: |
22+
echo "KRB_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
23+
24+
- name: Login to Aliyun Container Registry
25+
uses: docker/login-action@v3
26+
with:
27+
registry: ${{ vars.ALIYUNACR_REGISTRY }}
28+
username: ${{ vars.ALIYUNACR_USERNAME }}
29+
password: ${{ secrets.ALIYUNACR_TOKEN }}
30+
31+
- name: Login to Docker Hub
32+
uses: docker/login-action@v3
33+
with:
34+
username: ${{ vars.DOCKERHUB_USERNAME }}
35+
password: ${{ secrets.DOCKERHUB_TOKEN }}
36+
37+
- name: Set up Docker Buildx
38+
uses: docker/setup-buildx-action@v3
39+
40+
- name: Build and push krb-controller
41+
uses: docker/build-push-action@v6
42+
with:
43+
platforms: |
44+
linux/amd64
45+
linux/arm64
46+
push: true
47+
build-args: |
48+
KRB_APPNAME=krb-controller
49+
tags:
50+
registry.cn-hangzhou.aliyuncs.com/ketches/krb-controller:${{ env.KRB_VERSION }}
51+
registry.cn-hangzhou.aliyuncs.com/ketches/krb-controller:latest
52+
ketches/krb-controller:${{ env.KRB_VERSION }}
53+
ketches/krb-controller:latest
54+
55+
- name: Build and push krb-webhook
56+
uses: docker/build-push-action@v6
57+
with:
58+
platforms: |
59+
linux/amd64
60+
linux/arm64
61+
push: true
62+
build-args: |
63+
KRB_APPNAME=krb-webhook
64+
tags: |
65+
registry.cn-hangzhou.aliyuncs.com/ketches/krb-webhook:${{ env.KRB_VERSION }}
66+
registry.cn-hangzhou.aliyuncs.com/ketches/krb-webhook:latest
67+
ketches/krb-webhook:${{ env.KRB_VERSION }}
68+
ketches/krb-webhook:latest

.github/workflows/release.yml

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
# .github/workflows/release.yml
22
name: release
33

4-
env:
5-
ALIYUN_REGISTRY: registry.cn-hangzhou.aliyuncs.com/ketches
6-
74
on:
85
pull_request:
96
push:
@@ -43,26 +40,34 @@ jobs:
4340
- name: Build and push krb-controller
4441
uses: docker/build-push-action@v6
4542
with:
46-
platforms: linux/amd64,linux/arm64
43+
platforms: |
44+
linux/amd64
45+
linux/arm64
4746
push: true
4847
build-args: |
4948
KRB_APPNAME=krb-controller
50-
tags: ${{ vars.ALIYUNACR_REGISTRY }}/${{ vars.ALIYUNACR_NAMESPACE }}/krb-controller:${{ env.KRB_VERSION }},${{ vars.ALIYUNACR_REGISTRY }}/${{ vars.ALIYUNACR_NAMESPACE }}/krb-controller:latest
49+
tags:
50+
registry.cn-hangzhou.aliyuncs.com/ketches/krb-controller:${{ env.KRB_VERSION }}
51+
registry.cn-hangzhou.aliyuncs.com/ketches/krb-controller:latest
52+
ketches/krb-controller:${{ env.KRB_VERSION }}
53+
ketches/krb-controller:latest
5154

5255
- name: Build and push krb-webhook
5356
uses: docker/build-push-action@v6
5457
with:
5558
platforms: |
56-
- linux/amd64
57-
- linux/arm64
59+
linux/amd64
60+
linux/arm64
5861
push: true
5962
build-args: |
6063
KRB_APPNAME=krb-webhook
6164
tags: |
62-
- ${{ vars.ALIYUNACR_REGISTRY }}/${{ vars.ALIYUNACR_NAMESPACE }}/krb-webhook:${{ env.KRB_VERSION }}
63-
- ${{ vars.ALIYUNACR_REGISTRY }}/${{ vars.ALIYUNACR_NAMESPACE }}/krb-controller:latest
65+
registry.cn-hangzhou.aliyuncs.com/ketches/krb-webhook:${{ env.KRB_VERSION }}
66+
registry.cn-hangzhou.aliyuncs.com/ketches/krb-webhook:latest
67+
ketches/krb-webhook:${{ env.KRB_VERSION }}
68+
ketches/krb-webhook:latest
6469
65-
goreleaser:
70+
release:
6671
runs-on: ubuntu-latest
6772
steps:
6873
- name: Checkout

0 commit comments

Comments
 (0)