From 2f4cd4e9d33342227429a836a30f1299edb928cc Mon Sep 17 00:00:00 2001 From: Mizuki Date: Wed, 1 Nov 2023 16:33:54 +0900 Subject: [PATCH 1/2] use github.repository_owner in IMAGE_NAME in docker build workflows --- .github/workflows/docker-build-genesis-deployer.yml | 2 +- .github/workflows/docker-build-genesis-init-predeploy.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker-build-genesis-deployer.yml b/.github/workflows/docker-build-genesis-deployer.yml index cc17bc7..a427d96 100644 --- a/.github/workflows/docker-build-genesis-deployer.yml +++ b/.github/workflows/docker-build-genesis-deployer.yml @@ -8,7 +8,7 @@ on: env: REGISTRY: ghcr.io - IMAGE_NAME: planetarium/mothership-l2launcher-genesis-deployer + IMAGE_NAME: ${{ github.repository_owner }}/mothership-l2launcher-genesis-deployer jobs: build: diff --git a/.github/workflows/docker-build-genesis-init-predeploy.yml b/.github/workflows/docker-build-genesis-init-predeploy.yml index 3908ab7..83cd100 100644 --- a/.github/workflows/docker-build-genesis-init-predeploy.yml +++ b/.github/workflows/docker-build-genesis-init-predeploy.yml @@ -8,7 +8,7 @@ on: env: REGISTRY: ghcr.io - IMAGE_NAME: planetarium/mothership-l2launcher-genesis-init-predeploy + IMAGE_NAME: ${{ github.repository_owner }}/mothership-l2launcher-genesis-init-predeploy jobs: build: From 1baa3b3a16f2435ec8c69a916f8a31da954fd4e6 Mon Sep 17 00:00:00 2001 From: Mizuki Date: Wed, 1 Nov 2023 18:11:27 +0900 Subject: [PATCH 2/2] push docker image only if github.repository_owner is planetarium --- .github/workflows/docker-build-genesis-deployer.yml | 8 ++++---- .github/workflows/docker-build-genesis-init-predeploy.yml | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/docker-build-genesis-deployer.yml b/.github/workflows/docker-build-genesis-deployer.yml index a427d96..370ea5a 100644 --- a/.github/workflows/docker-build-genesis-deployer.yml +++ b/.github/workflows/docker-build-genesis-deployer.yml @@ -21,14 +21,14 @@ jobs: steps: - name: Install cosign - if: github.event_name != 'pull_request' + if: github.event_name != 'pull_request' && github.repository_owner == 'planetarium' uses: sigstore/cosign-installer@v3.1.1 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3.0.0 - name: Log into registry ${{ env.REGISTRY }} - if: github.event_name != 'pull_request' + if: github.event_name != 'pull_request' && github.repository_owner == 'planetarium' uses: docker/login-action@v3.0.0 with: registry: ${{ env.REGISTRY }} @@ -52,14 +52,14 @@ jobs: with: context: "{{defaultContext}}:genesis-deployer" platforms: linux/amd64,linux/arm64/v8 - push: ${{ github.event_name != 'pull_request' }} + push: ${{ github.event_name != 'pull_request' && github.repository_owner == 'planetarium' }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} cache-from: type=gha cache-to: type=gha,mode=max - name: Sign the published Docker image - if: ${{ github.event_name != 'pull_request' }} + if: ${{ github.event_name != 'pull_request' && github.repository_owner == 'planetarium' }} run: echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST} env: TAGS: ${{ steps.meta.outputs.tags }} diff --git a/.github/workflows/docker-build-genesis-init-predeploy.yml b/.github/workflows/docker-build-genesis-init-predeploy.yml index 83cd100..879f8b8 100644 --- a/.github/workflows/docker-build-genesis-init-predeploy.yml +++ b/.github/workflows/docker-build-genesis-init-predeploy.yml @@ -21,14 +21,14 @@ jobs: steps: - name: Install cosign - if: github.event_name != 'pull_request' + if: github.event_name != 'pull_request' && github.repository_owner == 'planetarium' uses: sigstore/cosign-installer@v3.1.1 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3.0.0 - name: Log into registry ${{ env.REGISTRY }} - if: github.event_name != 'pull_request' + if: github.event_name != 'pull_request' && github.repository_owner == 'planetarium' uses: docker/login-action@v3.0.0 with: registry: ${{ env.REGISTRY }} @@ -52,14 +52,14 @@ jobs: with: context: "{{defaultContext}}:genesis-init-predeploy" platforms: linux/amd64,linux/arm64/v8 - push: ${{ github.event_name != 'pull_request' }} + push: ${{ github.event_name != 'pull_request' && github.repository_owner == 'planetarium' }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} cache-from: type=gha cache-to: type=gha,mode=max - name: Sign the published Docker image - if: ${{ github.event_name != 'pull_request' }} + if: ${{ github.event_name != 'pull_request' && github.repository_owner == 'planetarium' }} run: echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST} env: TAGS: ${{ steps.meta.outputs.tags }}