Skip to content

Commit c9e1b78

Browse files
fix: Correct version extraction in publish workflows (#29)
fix: correct version extraction in docker workflow
1 parent deb9e2e commit c9e1b78

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

.github/workflows/publish-docker.yml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ name: Publish to Docker Hub
22

33
on:
44
push:
5-
branches:
6-
- main
75
tags:
86
- "v*"
97
workflow_dispatch:
@@ -12,6 +10,7 @@ on:
1210
description: "Version (e.g., 1.0.0)"
1311
required: true
1412
type: string
13+
1514
env:
1615
IMAGE_NAME: iexec/mcp-server
1716

@@ -27,11 +26,17 @@ jobs:
2726
run: |
2827
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
2928
VERSION="${{ github.event.inputs.version }}"
29+
elif [ "${{ github.ref_type }}" = "tag" ]; then
30+
VERSION=${GITHUB_REF_NAME#v}
3031
else
31-
VERSION=${GITHUB_REF#refs/tags/v}
32+
echo "Error: This workflow should only run on tags or workflow_dispatch"
33+
exit 1
3234
fi
3335
echo "version=$VERSION" >> $GITHUB_OUTPUT
34-
echo "Building Docker image: $VERSION"
36+
echo "Building Docker image for version: $VERSION"
37+
38+
- name: Set up Docker Buildx
39+
uses: docker/setup-buildx-action@v3
3540

3641
- name: Login to Docker Hub
3742
uses: docker/login-action@v3
@@ -48,6 +53,8 @@ jobs:
4853
tags: |
4954
${{ env.IMAGE_NAME }}:${{ steps.version.outputs.version }}
5055
${{ env.IMAGE_NAME }}:latest
56+
cache-from: type=gha
57+
cache-to: type=gha,mode=max
5158

5259
- name: Success notification
5360
run: |

0 commit comments

Comments
 (0)