Skip to content

Commit a648a74

Browse files
committed
update at 2024-08-09 10:50:21
1 parent 0f23908 commit a648a74

File tree

2 files changed

+146
-0
lines changed

2 files changed

+146
-0
lines changed

.github/workflows/docker-ci.yaml

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
name: Docker Image CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
tags:
8+
- v*
9+
paths-ignore:
10+
- "**.md"
11+
- charts/**
12+
- hack/**
13+
14+
env:
15+
REGISTRY_IMAGE: imroc/tke-extend-network-controller
16+
17+
jobs:
18+
build:
19+
runs-on: ubuntu-22.04
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
platform:
24+
- linux/amd64
25+
- linux/arm64
26+
- linux/arm/v6
27+
- linux/arm/v7
28+
- linux/386
29+
- linux/ppc64le
30+
- linux/s390x
31+
steps:
32+
- name: Prepare
33+
run: |
34+
platform=${{ matrix.platform }}
35+
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
36+
- name: Checkout
37+
uses: actions/checkout@v4
38+
- name: Docker meta
39+
id: meta
40+
uses: docker/metadata-action@v5
41+
with:
42+
images: ${{ env.REGISTRY_IMAGE }}
43+
tags: |
44+
type=ref,event=branch
45+
type=ref,event=pr
46+
type=semver,pattern=v{{version}}
47+
type=semver,pattern=v{{major}}.{{minor}}
48+
type=semver,pattern=v{{major}}
49+
- name: Set up QEMU
50+
uses: docker/setup-qemu-action@v3
51+
- name: Set up Docker Buildx
52+
uses: docker/setup-buildx-action@v3
53+
- name: Login to Docker Hub
54+
uses: docker/login-action@v3
55+
with:
56+
username: ${{ secrets.DOCKERHUB_USERNAME }}
57+
password: ${{ secrets.DOCKERHUB_TOKEN }}
58+
- name: Build and push
59+
id: build
60+
uses: docker/build-push-action@v5
61+
with:
62+
context: .
63+
platforms: ${{ matrix.platform }}
64+
tags: ${{ steps.meta.outputs.tags }}
65+
labels: ${{ steps.meta.outputs.labels }}
66+
push: true # shorthand of --output type=image,push=true
67+
outputs: name-canonical=true # add additional canonical name name@<digest>
68+
- name: Export digest
69+
run: |
70+
mkdir -p /tmp/digests
71+
digest="${{ steps.build.outputs.digest }}"
72+
touch "/tmp/digests/${digest#sha256:}"
73+
- name: Upload digest
74+
uses: actions/upload-artifact@v4
75+
with:
76+
name: digests-${{ env.PLATFORM_PAIR }}
77+
path: /tmp/digests/*
78+
if-no-files-found: error
79+
retention-days: 1
80+
merge:
81+
runs-on: ubuntu-22.04
82+
needs:
83+
- build
84+
steps:
85+
- name: Download digests
86+
uses: actions/download-artifact@v4
87+
with:
88+
path: /tmp/digests
89+
pattern: digests-*
90+
merge-multiple: true
91+
- name: Set up Docker Buildx
92+
uses: docker/setup-buildx-action@v3
93+
- name: Docker meta
94+
id: meta
95+
uses: docker/metadata-action@v5
96+
with:
97+
images: ${{ env.REGISTRY_IMAGE }}
98+
tags: |
99+
type=ref,event=branch
100+
type=ref,event=pr
101+
type=semver,pattern=v{{version}}
102+
type=semver,pattern=v{{major}}.{{minor}}
103+
type=semver,pattern=v{{major}}
104+
- name: Login to Docker Hub
105+
uses: docker/login-action@v3
106+
with:
107+
username: ${{ secrets.DOCKERHUB_USERNAME }}
108+
password: ${{ secrets.DOCKERHUB_TOKEN }}
109+
- name: Create manifest list and push
110+
working-directory: /tmp/digests
111+
run: |
112+
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
113+
$(printf '${{ env.REGISTRY_IMAGE }}@sha256:%s ' *)
114+
- name: Inspect image
115+
run: |
116+
docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ steps.meta.outputs.version }}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Release Charts
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
jobs:
8+
release:
9+
permissions:
10+
contents: write # to push chart release and create a release (helm/chart-releaser-action)
11+
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout Code
15+
uses: actions/checkout@v4
16+
with:
17+
fetch-depth: 0
18+
19+
- name: Configure Git
20+
run: |
21+
git config user.name "roc"
22+
git config user.email "[email protected]"
23+
24+
- name: Set up Helm
25+
uses: azure/setup-helm@v4
26+
27+
- name: Run chart-releaser
28+
uses: helm/[email protected]
29+
env:
30+
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"

0 commit comments

Comments
 (0)