Skip to content

Commit 3c5a1ce

Browse files
committed
Fix GitHub workflow to use dynamic branch-based Docker tags
- Replace hardcoded 'nightly' tag with docker/metadata-action - Automatically tags Docker images based on branch name - Supports branch pushes, PRs, and SHA-based tags - Adds required checkout step for metadata action
1 parent facea8d commit 3c5a1ce

1 file changed

Lines changed: 19 additions & 5 deletions

File tree

.github/workflows/DiscordBot.yml

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,21 +40,35 @@ jobs:
4040
docker:
4141
runs-on: ubuntu-latest
4242
steps:
43+
- name: Checkout
44+
uses: actions/checkout@v2
45+
4346
- name: Set up QEMU
4447
uses: docker/setup-qemu-action@v1
45-
48+
4649
- name: Set up Docker Buildx
4750
uses: docker/setup-buildx-action@v1
48-
51+
52+
- name: Docker meta
53+
id: meta
54+
uses: docker/metadata-action@v4
55+
with:
56+
images: plop91/plop_discord
57+
tags: |
58+
type=ref,event=branch
59+
type=ref,event=pr
60+
type=sha,prefix={{branch}}-
61+
4962
- name: Login to DockerHub
50-
uses: docker/login-action@v1
63+
uses: docker/login-action@v1
5164
with:
5265
username: ${{ secrets.DOCKER_USERNAME }}
5366
password: ${{ secrets.DOCKER_SECRET }}
54-
67+
5568
- name: Build and push
5669
id: docker_build
5770
uses: docker/build-push-action@v2
5871
with:
5972
push: true
60-
tags: plop91/plop_discord:nightly
73+
tags: ${{ steps.meta.outputs.tags }}
74+
labels: ${{ steps.meta.outputs.labels }}

0 commit comments

Comments
 (0)