Skip to content

Commit 1f0ecd9

Browse files
authored
fix: separate docker build (#112)
1 parent 840458e commit 1f0ecd9

File tree

3 files changed

+32
-9
lines changed

3 files changed

+32
-9
lines changed

.github/workflows/docker-build.yml

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,14 +75,37 @@ jobs:
7575
username: ${{ secrets.DOCKERHUB_USERNAME }}
7676
password: ${{ secrets.DOCKERHUB_TOKEN }}
7777

78+
- name: Compute release version
79+
id: vars
80+
shell: bash
81+
run: |
82+
is_release=false
83+
version=""
84+
85+
if [[ "${GITHUB_REF_TYPE:-}" == "tag" ]]; then
86+
tag="${GITHUB_REF_NAME}"
87+
prefix="${{ inputs.tag_prefix }}"
88+
89+
if [[ -n "$prefix" && "$tag" == "$prefix"-v* ]]; then
90+
version="${tag#"$prefix"-v}"
91+
is_release=true
92+
elif [[ -z "$prefix" && "$tag" == v* ]]; then
93+
version="${tag#v}"
94+
is_release=true
95+
fi
96+
fi
97+
98+
echo "is_release=$is_release" >> "$GITHUB_OUTPUT"
99+
echo "version=$version" >> "$GITHUB_OUTPUT"
100+
78101
- name: Docker metadata
79102
id: meta
80103
uses: docker/metadata-action@v5
81104
with:
82105
images: ${{ inputs.image }}
83106
tags: |
84-
type=semver,pattern={{version}},prefix=${{ inputs.tag_prefix }}
85-
type=sha,prefix=${{ inputs.tag_prefix }}
107+
type=raw,value=${{ steps.vars.outputs.version }},enable=${{ steps.vars.outputs.is_release == 'true' }}
108+
type=sha,prefix=sha-
86109
87110
- name: Build${{ inputs.push && ' & push' || '' }}
88111
uses: docker/build-push-action@v6
@@ -94,7 +117,7 @@ jobs:
94117
tags: ${{ steps.meta.outputs.tags }}
95118
labels: ${{ steps.meta.outputs.labels }}
96119
build-args: |
97-
VERSION=${{ steps.meta.outputs.version || github.sha }}
120+
VERSION=${{ steps.vars.outputs.version || github.sha }}
98121
VCS_REF=${{ github.sha }}
99122
cache-from: type=gha
100123
cache-to: type=gha,mode=max

.github/workflows/docker-merrymaker-go.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
- ".github/workflows/docker-*.yml"
88
push:
99
tags:
10-
- "v*.*.*"
10+
- "merrymaker-go-v*.*.*"
1111

1212
permissions:
1313
contents: read
@@ -22,8 +22,8 @@ jobs:
2222
uses: ./.github/workflows/docker-build.yml
2323
secrets: inherit
2424
with:
25-
image: target/merrymaker
26-
tag_prefix: merrymaker-go-
25+
image: target/merrymaker-go
26+
tag_prefix: merrymaker-go
2727
context: services/merrymaker-go
2828
dockerfile: services/merrymaker-go/Dockerfile
2929
push: ${{ github.event_name == 'push' }}

.github/workflows/docker-puppeteer-worker.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
- ".github/workflows/docker-*.yml"
88
push:
99
tags:
10-
- "v*.*.*"
10+
- "puppeteer-worker-v*.*.*"
1111

1212
permissions:
1313
contents: read
@@ -22,8 +22,8 @@ jobs:
2222
uses: ./.github/workflows/docker-build.yml
2323
secrets: inherit
2424
with:
25-
image: target/merrymaker
26-
tag_prefix: puppeteer-worker-
25+
image: target/puppeteer-worker
26+
tag_prefix: puppeteer-worker
2727
context: services/puppeteer-worker
2828
dockerfile: services/puppeteer-worker/Dockerfile
2929
push: ${{ github.event_name == 'push' }}

0 commit comments

Comments
 (0)