From c0dd53ba19209035403f7cb7cf67238322d10ab0 Mon Sep 17 00:00:00 2001 From: Yohsuke Fukai Date: Tue, 30 Jan 2024 12:45:21 +0900 Subject: [PATCH 1/2] update --- .../workflows/delete-docker-on-pr-close.yml | 54 ++----------------- 1 file changed, 4 insertions(+), 50 deletions(-) diff --git a/.github/workflows/delete-docker-on-pr-close.yml b/.github/workflows/delete-docker-on-pr-close.yml index b474481..5fe2096 100644 --- a/.github/workflows/delete-docker-on-pr-close.yml +++ b/.github/workflows/delete-docker-on-pr-close.yml @@ -53,59 +53,13 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - # Extract metadata (tags, labels) for Docker - # https://github.com/docker/metadata-action - - name: Extract Docker metadata (JAX conda CPU) - id: meta_jax_conda - uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 - with: - images: ${{ env.REGISTRY }}/${{ env.JAX_CONDA_IMAGE_NAME }} - tags: | - type=schedule - type=ref,event=branch - type=ref,event=tag - type=ref,event=pr - - - name: Extract Docker metadata (JAX conda GPU) - id: meta_jax_conda_cuda - uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 - with: - images: ${{ env.REGISTRY }}/${{ env.JAX_CONDA_IMAGE_NAME }} - tags: | - type=schedule,suffix=-cuda - type=ref,event=branch,suffix=-cuda - type=ref,event=tag,suffix=-cuda - type=ref,event=pr,suffix=-cuda - - - name: Extract Docker metadata (CPU) - id: meta - uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 - with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - tags: | - type=schedule - type=ref,event=branch - type=ref,event=tag - type=ref,event=pr - - - name: Extract Docker metadata (GPU) - id: meta_cuda - uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 - with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - tags: | - type=schedule,suffix=-cuda - type=ref,event=branch,suffix=-cuda - type=ref,event=tag,suffix=-cuda - type=ref,event=pr,suffix=-cuda - - name: Delete image (JAX conda CPU) uses: bots-house/ghcr-delete-image-action@v1.1.0 with: owner: yfukai name: ${{ env.JAX_CONDA_IMAGE_NAME }} token: ${{ secrets.GITHUB_TOKEN }} - tag: ${{ steps.meta_jax_conda.outputs.tags }} + tag: pr-${{github.event.pull_request.number }} - name: Delete image (JAX conda GPU) uses: bots-house/ghcr-delete-image-action@v1.1.0 @@ -113,7 +67,7 @@ jobs: owner: yfukai name: ${{ env.JAX_CONDA_IMAGE_NAME }} token: ${{ secrets.GITHUB_TOKEN }} - tag: ${{ steps.meta_jax_conda_cuda.outputs.tags }} + tag: pr-${{github.event.pull_request.number }}-cuda - name: Delete image (JAX conda CPU) uses: bots-house/ghcr-delete-image-action@v1.1.0 @@ -121,7 +75,7 @@ jobs: owner: yfukai name: ${{ env.IMAGE_NAME }} token: ${{ secrets.GITHUB_TOKEN }} - tag: ${{ steps.meta.outputs.tags }} + tag: pr-${{github.event.pull_request.number }} - name: Delete image (JAX conda GPU) uses: bots-house/ghcr-delete-image-action@v1.1.0 @@ -129,4 +83,4 @@ jobs: owner: yfukai name: ${{ env.IMAGE_NAME }} token: ${{ secrets.GITHUB_TOKEN }} - tag: ${{ steps.meta_cuda.outputs.tags }} + tag: pr-${{github.event.pull_request.number }}-cuda From aae36b814fd31abbb76c33da13148d53c11c8b0d Mon Sep 17 00:00:00 2001 From: Yohsuke Fukai Date: Tue, 30 Jan 2024 12:51:51 +0900 Subject: [PATCH 2/2] fixed workflow bugs --- .github/workflows/delete-docker-on-pr-close.yml | 2 +- .github/workflows/docker-publish.yml | 16 +++++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/.github/workflows/delete-docker-on-pr-close.yml b/.github/workflows/delete-docker-on-pr-close.yml index 5fe2096..388dbc7 100644 --- a/.github/workflows/delete-docker-on-pr-close.yml +++ b/.github/workflows/delete-docker-on-pr-close.yml @@ -1,4 +1,4 @@ -name: Docker +name: Docker delete tags # This workflow uses actions that are not certified by GitHub. # They are provided by a third-party and are governed by diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index bbaf403..e535908 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -1,4 +1,4 @@ -name: Docker +name: Docker Publish # This workflow uses actions that are not certified by GitHub. # They are provided by a third-party and are governed by @@ -70,10 +70,11 @@ jobs: - name: Extract first tag (JAX conda CPU) id: extract_first_tag_cpu run: | - # Extracting the first component - first_component=$(echo "${{ steps.meta_jax_conda.outputs.tags }}" | cut -d ',' -f 1) + # Extracting the first tag + tags="${{ steps.meta_jax_conda.outputs.tags }}" + first_line=$(echo "$tags" | head -n 1) # Setting the output - echo "meta_jax_conda_first_tag=$first_component" >> $GITHUB_OUTPUT + echo "meta_jax_conda_first_tag=$first_line" >> $GITHUB_OUTPUT - name: Extract Docker metadata (JAX conda GPU) id: meta_jax_conda_cuda @@ -89,10 +90,11 @@ jobs: - name: Extract first tag (JAX conda GPU) id: extract_first_tag_gpu run: | - # Extracting the first component - first_component=$(echo "${{ steps.meta_jax_conda_cuda.outputs.tags }}" | cut -d ',' -f 1) + # Extracting the first tag + tags="${{ steps.meta_jax_conda_cuda.outputs.tags }}" + first_line=$(echo "$tags" | head -n 1) # Setting the output - echo "meta_jax_conda_cuda_first_tag=$first_component" >> $GITHUB_OUTPUT + echo "meta_jax_conda_cuda_first_tag=$first_line" >> $GITHUB_OUTPUT - name: Extract Docker metadata (CPU) id: meta