From de21d686657ec238bb6e0ead3a7ce8704fa1853d Mon Sep 17 00:00:00 2001 From: pen <121443048+penginn-0@users.noreply.github.com> Date: Sat, 29 Jun 2024 18:00:42 +0900 Subject: [PATCH] =?UTF-8?q?=E3=82=B3=E3=83=B3=E3=83=86=E3=83=8A=E3=82=A4?= =?UTF-8?q?=E3=83=A1=E3=83=BC=E3=82=B8=E3=81=AECI=20(#130)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/docker-develop.yml | 19 +++++++----- .github/workflows/docker.yml | 46 ++++++++++------------------ 2 files changed, 27 insertions(+), 38 deletions(-) diff --git a/.github/workflows/docker-develop.yml b/.github/workflows/docker-develop.yml index ba537eadc7..bde593bc68 100644 --- a/.github/workflows/docker-develop.yml +++ b/.github/workflows/docker-develop.yml @@ -7,7 +7,7 @@ on: workflow_dispatch: env: - REGISTRY_IMAGE: noridev/cherrypick + REGISTRY_IMAGE: ghcr.io/${{ github.repository }} jobs: # see https://docs.docker.com/build/ci/github-actions/multi-platform/#distribute-build-across-multiple-runners @@ -20,7 +20,7 @@ jobs: platform: - linux/amd64 - linux/arm64 - if: github.repository == 'kokonect-link/cherrypick' + if: github.repository == 'yojo-art/cherrypick' steps: - name: Free Disk Space uses: jlumbroso/free-disk-space@main @@ -41,11 +41,12 @@ jobs: uses: actions/checkout@v4.1.1 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - - name: Log in to Docker Hub + - name: Log in to GitHub Container Registry uses: docker/login-action@v3 with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} - name: Build and push by digest id: build uses: docker/build-push-action@v5 @@ -84,11 +85,13 @@ jobs: merge-multiple: true - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - - name: Login to Docker Hub + - name: Login to GitHub Container Registry uses: docker/login-action@v3 with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + tags: ${{ env.REGISTRY_IMAGE }}:develop - name: Create manifest list and push working-directory: /tmp/digests run: | diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index c2f1901c98..015f269050 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -1,3 +1,4 @@ + name: Publish Docker image on: @@ -6,14 +7,7 @@ on: workflow_dispatch: env: - REGISTRY_IMAGE: noridev/cherrypick - TAGS: | - type=edge - type=ref,event=pr - type=ref,event=branch - type=semver,pattern={{version}} - type=semver,pattern={{major}}.{{minor}} - type=semver,pattern={{major}} + REGISTRY_IMAGE: ghcr.io/${{ github.repository }} jobs: # see https://docs.docker.com/build/ci/github-actions/multi-platform/#distribute-build-across-multiple-runners @@ -26,6 +20,7 @@ jobs: platform: - linux/amd64 - linux/arm64 + if: github.repository == 'yojo-art/cherrypick' steps: - name: Free Disk Space uses: jlumbroso/free-disk-space@main @@ -46,18 +41,13 @@ jobs: uses: actions/checkout@v4.1.1 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - - name: Docker meta - id: meta - uses: docker/metadata-action@v5 - with: - images: ${{ env.REGISTRY_IMAGE }} - tags: ${{ env.TAGS }} - - name: Log in to Docker Hub + - name: Log in to GitHub Container Registry uses: docker/login-action@v3 with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - - name: Build and Push to Docker Hub + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Build and push by digest id: build uses: docker/build-push-action@v5 with: @@ -65,7 +55,7 @@ jobs: push: true platforms: ${{ matrix.platform }} provenance: false - labels: ${{ steps.meta.outputs.labels }} + labels: master cache-from: type=gha cache-to: type=gha,mode=max outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true @@ -95,22 +85,18 @@ jobs: merge-multiple: true - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - - name: Docker meta - id: meta - uses: docker/metadata-action@v5 - with: - images: ${{ env.REGISTRY_IMAGE }} - tags: ${{ env.TAGS }} - - name: Login to Docker Hub + - name: Login to GitHub Container Registry uses: docker/login-action@v3 with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + tags: ${{ env.REGISTRY_IMAGE }}:${GITHUB_REF/refs\/tags\//} - name: Create manifest list and push working-directory: /tmp/digests run: | - docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ + docker buildx imagetools create --tag ${{ env.REGISTRY_IMAGE }}:${GITHUB_REF/refs\/tags\//} \ $(printf '${{ env.REGISTRY_IMAGE }}@sha256:%s ' *) - name: Inspect image run: | - docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ steps.meta.outputs.version }} + docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${GITHUB_REF/refs\/tags\//}