Skip to content

Commit 0878193

Browse files
authored
Fix build CI workflow (#298)
1 parent 2d8cd56 commit 0878193

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

.github/workflows/build.yaml

+14-5
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ on:
66
push:
77
# Sequence of patterns matched against refs/heads
88
branches:
9-
- develop
10-
- master
9+
- main
1110
tags:
1211
- "*"
1312

@@ -23,16 +22,26 @@ jobs:
2322
with:
2423
go-version-file: go.mod
2524

26-
# This step uses action-hub docker action: https://github.com/actions-hub/docker
2725
- name: Login to docker hub
2826
if: success()
2927
uses: docker/login-action@v3
3028
with:
3129
username: ${{ secrets.DOCKER_USERNAME }}
3230
password: ${{ secrets.DOCKER_PASSWORD }}
3331

34-
# Build docker image
35-
- name: Build docker image
32+
- name: Deduce image tag
33+
run: |
34+
if [[ -z "${IMAGE_TAG}" ]]; then \
35+
IMAGE_TAG=${GITHUB_REF#*/}; \
36+
IMAGE_TAG=${IMAGE_TAG#*/}; \
37+
IMAGE_TAG=$(echo $IMAGE_TAG | sed -e "s#^v##"); \
38+
if [[ "$IMAGE_TAG" == "master" || "$IMAGE_TAG" == "main" ]]; then \
39+
IMAGE_TAG=latest; \
40+
fi \
41+
fi && \
42+
echo "IMAGE_TAG=${IMAGE_TAG}" >> $GITHUB_ENV
43+
44+
- name: Build and push docker image
3645
if: success()
3746
shell: bash
3847
env:

go.mod

-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ module quortex.io/kubestitute
22

33
go 1.22.0
44

5-
toolchain go1.22.5
6-
75
require (
86
github.com/Masterminds/sprig/v3 v3.2.3
97
github.com/aws/aws-sdk-go v1.55.5

0 commit comments

Comments
 (0)