Skip to content

Commit 124e985

Browse files
Donatien26Eneman Donatien
andauthored
Build image docker on release (#74)
* [BUG] ci image is not published --------- Co-authored-by: Eneman Donatien <[email protected]>
1 parent d8c2686 commit 124e985

File tree

4 files changed

+30
-37
lines changed

4 files changed

+30
-37
lines changed

.github/workflows/ci-docker.yaml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,19 @@ on:
55
branches:
66
- "**"
77
paths-ignore:
8-
- 'docs/**'
8+
- "docs/**"
99
tags:
1010
- "**"
1111
pull_request:
1212
paths-ignore:
13-
- 'docs/**'
14-
15-
jobs:
13+
- "docs/**"
1614

15+
jobs:
1716
lint-docker:
1817
runs-on: ubuntu-latest
1918
steps:
2019
- name: Checkout code
2120
uses: actions/checkout@v4
22-
23-
2421
- uses: hadolint/[email protected]
2522
with:
2623
dockerfile: Dockerfile
@@ -33,7 +30,11 @@ jobs:
3330
contents: read
3431
with:
3532
ref: ${{ github.ref }}
36-
image-tag: ${{ github.ref }}
33+
image-tag: |
34+
type=schedule
35+
type=ref,event=branch
36+
type=ref,event=pr
37+
type=ref,event=tag
3738
secrets:
3839
registry_username: ${{ secrets.DOCKERHUB_USERNAME }}
39-
registry_password: ${{ secrets.DOCKERHUB_TOKEN }}
40+
registry_password: ${{ secrets.DOCKERHUB_TOKEN }}

.github/workflows/ci-go.yaml

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,14 @@ on:
55
branches:
66
- "**"
77
paths-ignore:
8-
- 'docs/**'
8+
- "docs/**"
99
tags:
1010
- "*"
1111
pull_request:
1212
paths-ignore:
13-
- 'docs/**'
13+
- "docs/**"
1414

1515
jobs:
16-
1716
go:
1817
runs-on: ubuntu-latest
1918
steps:
@@ -22,7 +21,7 @@ jobs:
2221
- name: Setup Go
2322
uses: actions/setup-go@v5
2423
with:
25-
go-version: '1.23.x'
24+
go-version: "1.23.x"
2625
- name: Install dependencies
2726
run: go mod download
2827
- name: Test with Go
@@ -34,8 +33,3 @@ jobs:
3433
path: cover.out
3534
- name: Build
3635
run: go build -v ./...
37-
- name: 'Upload Artifact'
38-
uses: actions/upload-artifact@v4
39-
with:
40-
name: manager
41-
path: ./bin/manager

.github/workflows/publish.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ on:
1010
image-tag:
1111
required: false
1212
type: string
13-
secrets:
13+
secrets:
1414
registry_username:
1515
required: true
1616
registry_password:
@@ -23,8 +23,8 @@ jobs:
2323
- name: Checkout code
2424
uses: actions/checkout@v4
2525
with:
26-
fetch-depth: 0 # Ensure full history
27-
ref: ${{ github.event.inputs.source_ref }}
26+
fetch-depth: 0 # Ensure full history
27+
ref: ${{ github.event.inputs.source_ref }}
2828

2929
- name: Docker meta
3030
id: docker_meta
@@ -42,8 +42,8 @@ jobs:
4242
if: github.event_name != 'pull_request'
4343
uses: docker/login-action@v3
4444
with:
45-
username: ${{ github.event.secrets.registry_username }}
46-
password: ${{ github.event.secrets.registry_password }}
45+
username: ${{ secrets.registry_username }}
46+
password: ${{ secrets.registry_password }}
4747

4848
- name: Build and push
4949
id: build_push
@@ -53,7 +53,7 @@ jobs:
5353
file: ./Dockerfile
5454
push: ${{ github.event_name != 'pull_request' }}
5555
tags: |
56-
${{ github.event.inputs.image-tag }}
56+
${{ steps.docker_meta.outputs.tags }}
5757
labels: ${{ steps.docker_meta.outputs.labels }}
5858
platforms: linux/amd64,linux/arm64
5959

.github/workflows/release.yml

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,19 @@ on:
1515
default: false
1616
type: boolean
1717

18-
1918
name: Make release
2019

2120
jobs:
22-
2321
create-release-branch:
2422
runs-on: ubuntu-latest
2523
permissions:
26-
contents: write # Allows pushing branches
24+
contents: write # Allows pushing branches
2725
steps:
2826
- name: Checkout repository
2927
uses: actions/checkout@v4
3028
with:
31-
fetch-depth: 0 # Ensure full history
32-
ref: ${{ github.event.inputs.source_ref }}
29+
fetch-depth: 0 # Ensure full history
30+
ref: ${{ github.event.inputs.source_ref }}
3331

3432
- name: Configure Git
3533
run: |
@@ -44,19 +42,20 @@ jobs:
4442
git checkout -b $NEW_BRANCH
4543
git push origin $NEW_BRANCH
4644
47-
48-
49-
5045
build-and-publish-docker:
51-
needs:
46+
needs:
5247
- create-release-branch
5348
uses: ./.github/workflows/publish.yaml
5449
permissions:
5550
id-token: write
5651
contents: read
5752
with:
5853
ref: ${{ github.ref }}
59-
image-tag: ${{ github.event.inputs.version }}
54+
image-tag: |
55+
type=semver,pattern={{raw}},value=${{ github.event.inputs.version }}
56+
type=semver,pattern=v{{major}}.{{minor}},value=${{ github.event.inputs.version }}
57+
type=semver,pattern=v{{major}},value=${{ github.event.inputs.version }}
58+
type=raw,value=latest,enable=${{ !github.event.inputs.pre_release }}
6059
secrets:
6160
registry_username: ${{ secrets.DOCKERHUB_USERNAME }}
6261
registry_password: ${{ secrets.DOCKERHUB_TOKEN }}
@@ -67,18 +66,17 @@ jobs:
6766
needs:
6867
- create-release-branch
6968
steps:
70-
7169
- name: Checkout code
7270
uses: actions/checkout@v4
73-
71+
7472
- name: Create Release
7573
id: create_release
76-
uses: softprops/action-gh-release@v2
74+
uses: softprops/action-gh-release@v2
7775
with:
7876
tag_name: ${{ github.event.inputs.version }}
7977
name: Release ${{ github.event.inputs.version }}
8078
draft: false
8179
prerelease: ${{ github.event.inputs.pre_release }}
8280
token: ${{ secrets.GITHUB_TOKEN }}
8381
generate_release_notes: true
84-
append_body: true
82+
append_body: true

0 commit comments

Comments
 (0)