Skip to content

Commit 3e2684d

Browse files
committed
fix: Refactor container image publishing workflow to streamline Docker login and push commands
1 parent 17a09fe commit 3e2684d

1 file changed

Lines changed: 9 additions & 8 deletions

File tree

.github/workflows/build-and-push-containers.yml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,32 +22,33 @@ jobs:
2222
with:
2323
dotnet-version: '10.0.x'
2424

25+
- name: docker login
26+
uses: docker/login-action@v4
27+
with:
28+
registry: ghcr.io
29+
username: ${{ github.actor }}
30+
password: ${{ secrets.GITHUB_TOKEN }}
31+
2532
- name: Publish API container image
2633
run: |
2734
dotnet publish src/Playground/Playground.Api/Playground.Api.csproj \
2835
-c Release -r linux-x64 \
2936
-p:PublishProfile=DefaultContainer \
30-
-p:ContainerRegistry=ghcr.io \
3137
-p:ContainerRepository=${{ github.repository_owner }}/fsh-playground-api \
32-
-p:ContainerRegistryUsername=${{ github.actor }} \
33-
-p:ContainerRegistryPassword=${{ secrets.GITHUB_TOKEN }} \
3438
-p:ContainerImageTags=${{ github.sha }}
3539
3640
- name: Publish Blazor container image
3741
run: |
3842
dotnet publish src/Playground/Playground.Blazor/Playground.Blazor.csproj \
3943
-c Release -r linux-x64 \
4044
-p:PublishProfile=DefaultContainer \
41-
-p:ContainerRegistry=ghcr.io \
4245
-p:ContainerRepository=${{ github.repository_owner }}/fsh-playground-blazor \
43-
-p:ContainerRegistryUsername=${{ github.actor }} \
44-
-p:ContainerRegistryPassword=${{ secrets.GITHUB_TOKEN }} \
4546
-p:ContainerImageTags=${{ github.sha }}
4647
4748
- name: Push API image to GHCR
4849
run: |
49-
docker push ghcr.io/${{ github.repository_owner }}/fsh-playground-api:${{ github.sha }}
50+
docker push ghcr.io/${{ github.repository_owner }}/fsh-playground-api:${{ github.sha }} --all-tags
5051
5152
- name: Push Blazor image to GHCR
5253
run: |
53-
docker push ghcr.io/${{ github.repository_owner }}/fsh-playground-blazor:${{ github.sha }}
54+
docker push ghcr.io/${{ github.repository_owner }}/fsh-playground-blazor:${{ github.sha }} --all-tags

0 commit comments

Comments
 (0)