Skip to content

Commit 68f3296

Browse files
committed
Refactor Docker publish workflow to remove manual tag setting and ensure correct tag handling for workflow dispatch
1 parent f3ec1c3 commit 68f3296

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

.github/workflows/docker-publish.yml

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ jobs:
2727
uses: actions/checkout@v4
2828
with:
2929
ref: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.tag || github.ref }}
30+
fetch-depth: 0
3031

3132
- name: Set up Docker Buildx
3233
uses: docker/setup-buildx-action@v3
@@ -44,12 +45,6 @@ jobs:
4445
username: ${{ github.actor }}
4546
password: ${{ secrets.GITHUB_TOKEN }}
4647

47-
- name: Set tag for manual dispatch
48-
if: github.event_name == 'workflow_dispatch'
49-
run: |
50-
echo "MANUAL_TAG=${{ github.event.inputs.tag }}" >> $GITHUB_ENV
51-
git tag ${{ github.event.inputs.tag }} || true
52-
5348
- name: Extract metadata (tags, labels) for Docker
5449
id: meta
5550
uses: docker/metadata-action@v5
@@ -58,10 +53,11 @@ jobs:
5853
gmag11/metatrader5_vnc
5954
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
6055
tags: |
61-
type=semver,pattern={{version}}
62-
type=semver,pattern={{major}}.{{minor}}
63-
type=semver,pattern={{major}}
64-
type=raw,value=latest
56+
type=semver,pattern={{version}},enable=${{ github.event_name == 'push' }}
57+
type=semver,pattern={{major}}.{{minor}},enable=${{ github.event_name == 'push' }}
58+
type=semver,pattern={{major}},enable=${{ github.event_name == 'push' }}
59+
type=raw,value=latest,enable=${{ github.event_name == 'push' }}
60+
type=raw,value=${{ github.event.inputs.tag }},enable=${{ github.event_name == 'workflow_dispatch' }}
6561
6662
- name: Build and push Docker image
6763
id: docker_build

0 commit comments

Comments
 (0)