Skip to content

Commit afea32d

Browse files
committed
update workflows
Signed-off-by: Markus Blaschke <mblaschke82@gmail.com>
1 parent 2fed009 commit afea32d

File tree

7 files changed

+92
-140
lines changed

7 files changed

+92
-140
lines changed

.github/dependabot.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "github-actions"
4+
directory: "/"
5+
schedule:
6+
interval: "weekly"
7+
8+
- package-ecosystem: "docker"
9+
directory: "/"
10+
schedule:
11+
interval: "weekly"
12+
13+
- package-ecosystem: "gomod"
14+
directory: "/"
15+
schedule:
16+
interval: "weekly"
Lines changed: 44 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,68 @@
1-
name: "Scheduled: docker"
1+
name: build/docker
22

33
on:
4-
schedule:
5-
- cron: '0 6 * * 1'
4+
workflow_call:
5+
inputs:
6+
publish:
7+
required: true
8+
type: boolean
69

710
jobs:
811
lint:
912
runs-on: ubuntu-latest
1013
steps:
11-
- uses: actions/checkout@v2
14+
- uses: actions/checkout@v4
1215

1316
- name: Set Swap Space
14-
uses: pierotofy/set-swap-space@master
17+
uses: pierotofy/set-swap-space@49819abfb41bd9b44fb781159c033dba90353a7c
1518
with:
1619
swap-size-gb: 12
1720

1821
- name: Run Golangci lint
19-
uses: golangci/golangci-lint-action@v2
22+
uses: golangci/golangci-lint-action@v3
2023
with:
2124
version: latest
2225
args: --print-resources-usage
2326

2427
build:
28+
name: "build ${{ matrix.Dockerfile }}:${{ matrix.target }}"
2529
needs: lint
2630
strategy:
2731
fail-fast: false
2832
matrix:
29-
Dockerfile: [Dockerfile]
30-
suffix: [""]
31-
latest: ["auto"]
32-
include: []
33+
include:
34+
- Dockerfile: Dockerfile
35+
target: "final-ubuntu"
36+
suffix: ""
37+
latest: "auto"
38+
39+
- Dockerfile: Dockerfile
40+
target: "final-alpine"
41+
suffix: "-alpine"
42+
latest: false
43+
44+
- Dockerfile: Dockerfile
45+
target: "final-kubernetes"
46+
suffix: "-kubernetes"
47+
latest: false
48+
49+
- Dockerfile: Dockerfile
50+
target: "final-distroless"
51+
suffix: "-distroless"
52+
latest: false
53+
3354
runs-on: ubuntu-latest
3455
steps:
35-
- uses: actions/checkout@v2
56+
- uses: actions/checkout@v4
3657

3758
- name: Set Swap Space
38-
uses: pierotofy/set-swap-space@master
59+
uses: pierotofy/set-swap-space@49819abfb41bd9b44fb781159c033dba90353a7c
3960
with:
4061
swap-size-gb: 12
4162

4263
- name: Docker meta
4364
id: docker_meta
44-
uses: docker/metadata-action@v4
65+
uses: docker/metadata-action@v5
4566
with:
4667
images: ${{ github.repository }},quay.io/${{ github.repository }}
4768
labels: |
@@ -51,30 +72,33 @@ jobs:
5172
suffix=${{ matrix.suffix }}
5273
5374
- name: Set up QEMU
54-
uses: docker/setup-qemu-action@v1
75+
uses: docker/setup-qemu-action@v3
5576

5677
- name: Set up Docker Buildx
57-
uses: docker/setup-buildx-action@v1
78+
uses: docker/setup-buildx-action@v3
5879

5980
- name: Login to DockerHub
60-
uses: docker/login-action@v1
81+
uses: docker/login-action@v3
82+
if: ${{ inputs.publish }}
6183
with:
6284
username: ${{ secrets.DOCKERHUB_USERNAME }}
6385
password: ${{ secrets.DOCKERHUB_TOKEN }}
6486

6587
- name: Login to Quay
66-
uses: docker/login-action@v1
88+
uses: docker/login-action@v3
89+
if: ${{ inputs.publish }}
6790
with:
6891
registry: quay.io
6992
username: ${{ secrets.QUAY_USERNAME }}
7093
password: ${{ secrets.QUAY_TOKEN }}
7194

72-
- name: Build and push
73-
uses: docker/build-push-action@v2
95+
- name: ${{ inputs.publish && 'Build and push' || 'Build' }}
96+
uses: docker/build-push-action@v5
7497
with:
7598
context: .
7699
file: ./${{ matrix.Dockerfile }}
100+
target: ${{ matrix.target }}
77101
platforms: linux/amd64,linux/arm64
78-
push: ${{ github.event_name != 'pull_request' }}
102+
push: ${{ inputs.publish }}
79103
tags: ${{ steps.docker_meta.outputs.tags }}
80104
labels: ${{ steps.docker_meta.outputs.labels }}

.github/workflows/ci-docker.yaml

Lines changed: 5 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,10 @@
1-
name: "CI docker"
1+
name: "ci/docker"
22

33
on: [pull_request, workflow_dispatch]
44

55
jobs:
66
build:
7-
runs-on: ubuntu-latest
8-
steps:
9-
- uses: actions/checkout@v2
10-
11-
- name: Set Swap Space
12-
uses: pierotofy/set-swap-space@master
13-
with:
14-
swap-size-gb: 12
15-
16-
- name: Run Golangci lint
17-
uses: golangci/golangci-lint-action@v2
18-
with:
19-
version: latest
20-
args: --print-resources-usage
21-
22-
- name: Docker meta
23-
id: docker_meta
24-
uses: docker/metadata-action@v3
25-
with:
26-
images: ${{ github.repository }},quay.io/${{ github.repository }}
27-
labels: |
28-
io.artifacthub.package.readme-url=https://raw.githubusercontent.com/${{ github.repository }}/${{ github.event.repository.default_branch }}/README.md
29-
30-
- name: Set up QEMU
31-
uses: docker/setup-qemu-action@v1
32-
33-
- name: Set up Docker Buildx
34-
uses: docker/setup-buildx-action@v1
35-
36-
- name: Build
37-
uses: docker/build-push-action@v2
38-
with:
39-
context: .
40-
file: ./Dockerfile
41-
push: false
42-
platforms: linux/amd64,linux/arm64
43-
tags: ${{ steps.docker_meta.outputs.tags }}
44-
labels: ${{ steps.docker_meta.outputs.labels }}
7+
uses: ./.github/workflows/build-docker.yaml
8+
secrets: inherit
9+
with:
10+
publish: false

.github/workflows/release-assets.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: "Release: assets"
1+
name: "release/assets"
22

33
on:
44
release:
@@ -8,16 +8,16 @@ jobs:
88
release:
99
runs-on: ubuntu-latest
1010
steps:
11-
- uses: actions/checkout@v2
11+
- uses: actions/checkout@v4
1212

1313
- name: Set Swap Space
14-
uses: pierotofy/set-swap-space@master
14+
uses: pierotofy/set-swap-space@49819abfb41bd9b44fb781159c033dba90353a7c
1515
with:
1616
swap-size-gb: 12
1717

18-
- uses: actions/setup-go@v2
18+
- uses: actions/setup-go@v5
1919
with:
20-
go-version: '1.20'
20+
go-version: '1.21'
2121
check-latest: true
2222

2323
- name: Build

.github/workflows/release-docker.yaml

Lines changed: 9 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -1,83 +1,17 @@
1-
name: "Release: docker"
1+
name: "release/docker"
22

33
on:
44
push:
55
branches:
6-
- '**'
6+
- 'main'
7+
- 'feature-**'
8+
- 'bugfix-**'
79
tags:
810
- '*.*.*'
911

1012
jobs:
11-
lint:
12-
runs-on: ubuntu-latest
13-
steps:
14-
- uses: actions/checkout@v2
15-
16-
- name: Set Swap Space
17-
uses: pierotofy/set-swap-space@master
18-
with:
19-
swap-size-gb: 12
20-
21-
- name: Run Golangci lint
22-
uses: golangci/golangci-lint-action@v2
23-
with:
24-
version: latest
25-
args: --print-resources-usage
26-
27-
build:
28-
needs: lint
29-
strategy:
30-
fail-fast: false
31-
matrix:
32-
Dockerfile: [Dockerfile]
33-
suffix: [""]
34-
latest: ["auto"]
35-
include: []
36-
runs-on: ubuntu-latest
37-
steps:
38-
- uses: actions/checkout@v2
39-
40-
- name: Set Swap Space
41-
uses: pierotofy/set-swap-space@master
42-
with:
43-
swap-size-gb: 12
44-
45-
- name: Docker meta
46-
id: docker_meta
47-
uses: docker/metadata-action@v4
48-
with:
49-
images: ${{ github.repository }},quay.io/${{ github.repository }}
50-
labels: |
51-
io.artifacthub.package.readme-url=https://raw.githubusercontent.com/${{ github.repository }}/${{ github.event.repository.default_branch }}/README.md
52-
flavor: |
53-
latest=${{ matrix.latest }}
54-
suffix=${{ matrix.suffix }}
55-
56-
- name: Set up QEMU
57-
uses: docker/setup-qemu-action@v1
58-
59-
- name: Set up Docker Buildx
60-
uses: docker/setup-buildx-action@v1
61-
62-
- name: Login to DockerHub
63-
uses: docker/login-action@v1
64-
with:
65-
username: ${{ secrets.DOCKERHUB_USERNAME }}
66-
password: ${{ secrets.DOCKERHUB_TOKEN }}
67-
68-
- name: Login to Quay
69-
uses: docker/login-action@v1
70-
with:
71-
registry: quay.io
72-
username: ${{ secrets.QUAY_USERNAME }}
73-
password: ${{ secrets.QUAY_TOKEN }}
74-
75-
- name: Build and push
76-
uses: docker/build-push-action@v2
77-
with:
78-
context: .
79-
file: ./${{ matrix.Dockerfile }}
80-
platforms: linux/amd64,linux/arm64
81-
push: ${{ github.event_name != 'pull_request' }}
82-
tags: ${{ steps.docker_meta.outputs.tags }}
83-
labels: ${{ steps.docker_meta.outputs.labels }}
13+
release:
14+
uses: ./.github/workflows/build-docker.yaml
15+
secrets: inherit
16+
with:
17+
publish: ${{ github.event_name != 'pull_request' }}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
name: "schedule/docker"
2+
3+
on:
4+
schedule:
5+
- cron: '45 6 * * 1'
6+
7+
jobs:
8+
schedule:
9+
uses: ./.github/workflows/build-docker.yaml
10+
secrets: inherit
11+
with:
12+
publish: true

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ RUN ["./kubectl", "version", "--client=true", "--output=yaml"]
3737
#############################################
3838
# Final
3939
#############################################
40-
FROM gcr.io/distroless/static
40+
FROM gcr.io/distroless/static as final-static
4141
ENV LOG_JSON=1
4242
WORKDIR /
4343
COPY --from=test /app .

0 commit comments

Comments
 (0)