From 00e1fc87eb10d99a8376cc5ae4bcd09ee5ba3668 Mon Sep 17 00:00:00 2001 From: MikuroXina Date: Sun, 5 Feb 2023 18:24:40 +0900 Subject: [PATCH 1/3] Use docker/metadata-action to mange tags --- .github/actions/publish/action.yml | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/.github/actions/publish/action.yml b/.github/actions/publish/action.yml index 0c0c46ae..fb0766b3 100644 --- a/.github/actions/publish/action.yml +++ b/.github/actions/publish/action.yml @@ -17,6 +17,25 @@ inputs: runs: using: composite steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Docker meta + id: meta + uses: docker/metadata-action@v4 + with: + images: | + approvers/oreorebot2 + ghcr.io/approvers/oreorebot2 + tags: | + type=schedule + type=ref,event=branch + type=ref,event=pr + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + type=semver,pattern={{major}} + type=sha + - name: Set up QEMU uses: docker/setup-qemu-action@v2 - name: Set up Docker Buildx @@ -29,12 +48,8 @@ runs: username: ${{ github.actor }} password: ${{ github.token }} - name: Build and push - uses: docker/build-push-action@v3 + uses: docker/build-push-action@v4 with: push: true - tags: | - approvers/oreorebot2:latest - approvers/oreorebot2:${{ inputs.sha }} - approvers/oreorebot2:v${{ inputs.major }} - approvers/oreorebot2:v${{ inputs.major }}.${{ inputs.minor }} - approvers/oreorebot2:v${{ inputs.major }}.${{ inputs.minor }}.${{ inputs.patch }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} From c85f46205283b59106033558504636e8c7a34e4f Mon Sep 17 00:00:00 2001 From: MikuroXina Date: Sun, 5 Feb 2023 18:25:07 +0900 Subject: [PATCH 2/3] Fix username into repository_owner --- .github/actions/publish/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/publish/action.yml b/.github/actions/publish/action.yml index fb0766b3..9513f8bf 100644 --- a/.github/actions/publish/action.yml +++ b/.github/actions/publish/action.yml @@ -45,7 +45,7 @@ runs: uses: docker/login-action@v2 with: registry: ghcr.io - username: ${{ github.actor }} + username: ${{ github.repository_owner }} password: ${{ github.token }} - name: Build and push uses: docker/build-push-action@v4 From db503e9c49d03c7ebf93f4c45e06a4e83d5fccbd Mon Sep 17 00:00:00 2001 From: MikuroXina Date: Sun, 5 Feb 2023 18:25:47 +0900 Subject: [PATCH 3/3] Enable build cache --- .github/actions/publish/action.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/actions/publish/action.yml b/.github/actions/publish/action.yml index 9513f8bf..94211c9f 100644 --- a/.github/actions/publish/action.yml +++ b/.github/actions/publish/action.yml @@ -53,3 +53,5 @@ runs: push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max