From 3fcdb9be9595806ae34f7efbff61337fb85690cb Mon Sep 17 00:00:00 2001 From: Nikolai Date: Sun, 28 Sep 2025 11:55:23 -0400 Subject: [PATCH 1/3] change tag naming --- .github/workflows/ci.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 2e6409d..68111ba 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -53,11 +53,11 @@ jobs: tags: | # main type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }} - type=sha,prefix=sha-,enable=${{ github.ref == 'refs/heads/main' }} + type=sha,enable=${{ github.ref == 'refs/heads/main' }} # dev type=raw,value=dev,enable=${{ github.ref == 'refs/heads/dev' }} - type=sha,prefix=dev-,enable=${{ github.ref == 'refs/heads/dev' }} + type=sha,enable=${{ github.ref == 'refs/heads/dev' }} - name: Build and push Docker image uses: docker/build-push-action@v6 From b216dd12231ca0e74b4ee74ea91559f1b75b5783 Mon Sep 17 00:00:00 2001 From: Nikolai Date: Sun, 28 Sep 2025 12:09:16 -0400 Subject: [PATCH 2/3] upd ci --- .github/workflows/ci.yaml | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 68111ba..cf4e348 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -35,8 +35,7 @@ jobs: run: dotnet build src/HelloEnv/HelloEnv.csproj -c Release --no-restore - name: Test - run: | - echo "No tests yet" + run: echo "No tests yet" - name: Log in to GHCR uses: docker/login-action@v3 @@ -45,24 +44,26 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - name: Extract metadata (tags, labels) - id: meta - uses: docker/metadata-action@v5 + - name: Get short commit SHA + id: vars + run: echo "sha_short=$(git rev-parse --short=7 HEAD)" >> $GITHUB_ENV + + - name: Build and push (main) + if: github.ref == 'refs/heads/main' + uses: docker/build-push-action@v6 with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + context: . + push: ${{ github.event_name != 'pull_request' }} tags: | - # main - type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }} - type=sha,enable=${{ github.ref == 'refs/heads/main' }} - - # dev - type=raw,value=dev,enable=${{ github.ref == 'refs/heads/dev' }} - type=sha,enable=${{ github.ref == 'refs/heads/dev' }} + ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest + ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.sha_short }} - - name: Build and push Docker image + - name: Build and push (dev) + if: github.ref == 'refs/heads/dev' uses: docker/build-push-action@v6 with: context: . push: ${{ github.event_name != 'pull_request' }} - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file + tags: | + ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:dev + ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.sha_short }} \ No newline at end of file From 7cc32911506510b8124c8272143cc51416a94fb4 Mon Sep 17 00:00:00 2001 From: Nikolai Date: Sun, 28 Sep 2025 12:14:33 -0400 Subject: [PATCH 3/3] upd --- .github/workflows/ci.yaml | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index cf4e348..68b674d 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -12,7 +12,7 @@ permissions: env: REGISTRY: ghcr.io - IMAGE_NAME: ${{ github.repository_owner }}/helloenv + IMAGE_NAME: helloenv DOTNET_VERSION: '9.0.x' jobs: @@ -44,9 +44,11 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} + - name: Get lowercase owner + run: echo "OWNER_LC=${GITHUB_REPOSITORY_OWNER,,}" >> $GITHUB_ENV + - name: Get short commit SHA - id: vars - run: echo "sha_short=$(git rev-parse --short=7 HEAD)" >> $GITHUB_ENV + run: echo "SHA_SHORT=$(git rev-parse --short=7 HEAD)" >> $GITHUB_ENV - name: Build and push (main) if: github.ref == 'refs/heads/main' @@ -55,8 +57,8 @@ jobs: context: . push: ${{ github.event_name != 'pull_request' }} tags: | - ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest - ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.sha_short }} + ${{ env.REGISTRY }}/${{ env.OWNER_LC }}/${{ env.IMAGE_NAME }}:latest + ${{ env.REGISTRY }}/${{ env.OWNER_LC }}/${{ env.IMAGE_NAME }}:${{ env.SHA_SHORT }} - name: Build and push (dev) if: github.ref == 'refs/heads/dev' @@ -65,5 +67,5 @@ jobs: context: . push: ${{ github.event_name != 'pull_request' }} tags: | - ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:dev - ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.sha_short }} \ No newline at end of file + ${{ env.REGISTRY }}/${{ env.OWNER_LC }}/${{ env.IMAGE_NAME }}:dev + ${{ env.REGISTRY }}/${{ env.OWNER_LC }}/${{ env.IMAGE_NAME }}:${{ env.SHA_SHORT }} \ No newline at end of file