From 918c8207f82860b76d5644011ee0012b90cb2190 Mon Sep 17 00:00:00 2001 From: Nano Taboada <87288+nanotaboada@users.noreply.github.com> Date: Sun, 4 May 2025 20:55:12 -0300 Subject: [PATCH 1/3] fix: missing fenced code block --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index e7e7c8b..e129022 100644 --- a/README.md +++ b/README.md @@ -48,6 +48,7 @@ docker build -t aspnetcore-app . ```bash docker run -p 9000:9000 aspnetcore-app +``` ## Credits From c6c29b54aad7b51e40b6161cf9d93be086fe6ac3 Mon Sep 17 00:00:00 2001 From: Nano Taboada <87288+nanotaboada@users.noreply.github.com> Date: Sun, 4 May 2025 20:57:11 -0300 Subject: [PATCH 2/3] feat(ci): update workflow to build and publish Docker image to GHCR --- .github/workflows/dotnet.yml | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index aa1fe3a..f734853 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -104,3 +104,35 @@ jobs: with: project-token: ${{ secrets.CODACY_PROJECT_TOKEN }} coverage-reports: cobertura.xml + + container: + needs: coverage + runs-on: ubuntu-latest + + permissions: + contents: read + packages: write + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Log in to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Build and push Docker image to GHCR + uses: docker/build-push-action@v5 + with: + context: . + push: true + tags: | + ghcr.io/${{ github.repository }}:latest + ghcr.io/${{ github.repository }}:main + ghcr.io/${{ github.repository }}:sha-${{ github.sha }} From 2a43eca107c0bbd2ee37606fd5ff37a880440e98 Mon Sep 17 00:00:00 2001 From: Nano Taboada <87288+nanotaboada@users.noreply.github.com> Date: Sun, 4 May 2025 21:11:23 -0300 Subject: [PATCH 3/3] fix(ci): add PACKAGE_NAME env variable with kebab-cased container name for GHCR --- .github/workflows/dotnet.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index f734853..2e85dd1 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -14,6 +14,7 @@ on: env: DOTNET_VERSION: 8.0.x + PACKAGE_NAME: nanotaboada/dotnet-samples-aspnetcore-webapi jobs: build: @@ -133,6 +134,6 @@ jobs: context: . push: true tags: | - ghcr.io/${{ github.repository }}:latest - ghcr.io/${{ github.repository }}:main - ghcr.io/${{ github.repository }}:sha-${{ github.sha }} + ghcr.io/${{ env.PACKAGE_NAME }}:latest + ghcr.io/${{ env.PACKAGE_NAME }}:main + ghcr.io/${{ env.PACKAGE_NAME }}:sha-${{ github.sha }}