From b4255303e3191cced91b61d7395a17f938e16204 Mon Sep 17 00:00:00 2001 From: MikuroXina Date: Wed, 27 Sep 2023 22:57:49 +0900 Subject: [PATCH 1/3] ci: Fix to set context --- .github/workflows/staging-apply.yaml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/staging-apply.yaml b/.github/workflows/staging-apply.yaml index 523cfb85..85dd9010 100644 --- a/.github/workflows/staging-apply.yaml +++ b/.github/workflows/staging-apply.yaml @@ -51,11 +51,15 @@ jobs: registry: ghcr.io username: ${{ github.repository_owner }} password: ${{ github.token }} + - name: Get context directory of Dockerfile + id: dockerfile-context + run: | + echo "context=$(dirname '${{ matrix.dockerfile }}')" >> $GITHUB_OUTPUT - name: Build and push uses: docker/build-push-action@v5 with: push: true - file: ${{ matrix.dockerfile }} + context: ${{ steps.dockerfile-context.outputs.context }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} cache-from: type=gha From 6e9b42ba5cfff0017a36f1f1fb78b80f847a1bca Mon Sep 17 00:00:00 2001 From: MikuroXina Date: Thu, 28 Sep 2023 16:03:52 +0900 Subject: [PATCH 2/3] Fix image name --- .github/workflows/staging-apply.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/staging-apply.yaml b/.github/workflows/staging-apply.yaml index 85dd9010..d2c71809 100644 --- a/.github/workflows/staging-apply.yaml +++ b/.github/workflows/staging-apply.yaml @@ -35,7 +35,7 @@ jobs: uses: docker/metadata-action@v5 with: images: | - ghcr.io/approvers/oreorebot2 + ghcr.io/approvers/pulsate tags: | ${{ github.sha }} type=raw,value=latest,enable={{is_default_branch}} From 675cb36ae799cac3567f641a645bfdb204113d28 Mon Sep 17 00:00:00 2001 From: MikuroXina Date: Thu, 28 Sep 2023 16:05:53 +0900 Subject: [PATCH 3/3] Fix to extract microservice name --- .github/workflows/staging-apply.yaml | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/.github/workflows/staging-apply.yaml b/.github/workflows/staging-apply.yaml index d2c71809..7166b6ac 100644 --- a/.github/workflows/staging-apply.yaml +++ b/.github/workflows/staging-apply.yaml @@ -30,12 +30,22 @@ jobs: steps: - uses: "actions/checkout@v4" + + - name: Get context directory of Dockerfile + id: dockerfile-context + run: | + echo "context=$(dirname '${{ matrix.dockerfile }}')" >> $GITHUB_OUTPUT + - name: Get microservice name + id: microservice-name + run: | + echo "service-name=$(basename '${{ steps.dockerfile-context.outputs.context }}')" >> $GITHUB_OUTPUT + - name: Docker meta id: meta uses: docker/metadata-action@v5 with: images: | - ghcr.io/approvers/pulsate + ghcr.io/approvers/pulsate/${{ steps.microservice-name.outputs.service-name }} tags: | ${{ github.sha }} type=raw,value=latest,enable={{is_default_branch}} @@ -51,10 +61,6 @@ jobs: registry: ghcr.io username: ${{ github.repository_owner }} password: ${{ github.token }} - - name: Get context directory of Dockerfile - id: dockerfile-context - run: | - echo "context=$(dirname '${{ matrix.dockerfile }}')" >> $GITHUB_OUTPUT - name: Build and push uses: docker/build-push-action@v5 with: