From cb925cc04bf1d580882f0b0021e7d6664a0e5fda Mon Sep 17 00:00:00 2001 From: civitaspo Date: Thu, 9 Sep 2021 15:37:35 +0900 Subject: [PATCH 1/2] Fix login user for ghcr.io --- .github/workflows/main.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 0a1ad41..5030052 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -72,7 +72,7 @@ jobs: uses: docker/login-action@v1 with: registry: ghcr.io - username: ${{ github.repository_owner }} + username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Build and Push uses: docker/build-push-action@v2 From 3fde50d3a2e5fa8daaf46c6e4f336923401b213c Mon Sep 17 00:00:00 2001 From: civitaspo Date: Thu, 9 Sep 2021 15:37:53 +0900 Subject: [PATCH 2/2] Add metadata to image --- .github/workflows/main.yaml | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 5030052..5faa4d8 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -58,12 +58,6 @@ jobs: steps: - uses: actions/checkout@v2 - - name: Get the Tag Name - id: get-tag - run: echo ::set-output name=tag::${GITHUB_REF#refs/*/} - - name: Show the Container Image URI - run: echo ${CONTAINER_IMAGE_REPOSITORY}:${{ steps.get-tag.outputs.tag }} - - name: Set up Docker Buildx uses: docker/setup-buildx-action@v1 with: @@ -74,11 +68,23 @@ jobs: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} + - name: Extract Docker metadata + id: meta + uses: docker/metadata-action@v3 + with: + images: ${{ env.CONTAINER_IMAGE_REPOSITORY }} + tags: | + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + type=ref,event=tag + type=schedule,pattern={{date 'YYYYMMDD'}} + type=sha - name: Build and Push uses: docker/build-push-action@v2 with: context: . push: true - tags: ${{ env.CONTAINER_IMAGE_REPOSITORY }}:${{ steps.get-tag.outputs.tag }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} cache-from: type=gha cache-to: type=gha,mode=max