File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed
Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -2,8 +2,6 @@ name: Publish to Docker Hub
22
33on :
44 push :
5- branches :
6- - main
75 tags :
86 - " v*"
97 workflow_dispatch :
1210 description : " Version (e.g., 1.0.0)"
1311 required : true
1412 type : string
13+
1514env :
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
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 : |
You can’t perform that action at this time.
0 commit comments