Skip to content

Commit 3e87d96

Browse files
authored
Merge pull request #35 from neurostuff/fix/docker_image_version
[FIX] propagate package version to docker build
2 parents 2e0428c + c677179 commit 3e87d96

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

.github/workflows/publish_docker.yml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,27 @@ jobs:
2828
- name: Set up Docker Buildx
2929
uses: docker/setup-buildx-action@v1
3030

31+
- name: Determine compose-runner version
32+
id: get_version
33+
run: |
34+
if [[ "${GITHUB_REF_TYPE}" == "branch" ]]; then
35+
VERSION="${GITHUB_SHA::12}"
36+
elif [[ "${GITHUB_REF_TYPE}" == "tag" ]]; then
37+
VERSION="${GITHUB_REF_NAME}"
38+
elif [[ "${GITHUB_REF_TYPE}" == "release" ]]; then
39+
VERSION="${GITHUB_REF_NAME}"
40+
else
41+
VERSION="${GITHUB_SHA::12}"
42+
fi
43+
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
44+
3145
- name: Build and push Docker image
3246
uses: docker/build-push-action@v2
3347
with:
3448
context: .
3549
push: true
36-
tags: ghcr.io/neurostuff/nsc-runner:${{ github.ref_name == 'main' && 'latest' || github.ref_name }}
50+
build-args: |
51+
COMPOSE_RUNNER_VERSION=${{ steps.get_version.outputs.version }}
52+
tags: |
53+
ghcr.io/neurostuff/nsc-runner:${{ steps.get_version.outputs.version }}
54+
ghcr.io/neurostuff/nsc-runner:${{ github.ref_name == 'main' && 'latest' || steps.get_version.outputs.version }}

0 commit comments

Comments
 (0)