From f85b660b08c1487274f2db296e9e5c7c0756f5e7 Mon Sep 17 00:00:00 2001 From: SnO2WMaN Date: Tue, 5 Dec 2023 11:17:32 +0900 Subject: [PATCH] =?UTF-8?q?=E3=81=84=E3=81=A3=E3=81=97=E3=82=87=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../docker-api-postgres-migration.yml | 36 ----------------- .../{docker-api.yml => docker-images.yml} | 40 +++++++++++++------ 2 files changed, 28 insertions(+), 48 deletions(-) delete mode 100644 .github/workflows/docker-api-postgres-migration.yml rename .github/workflows/{docker-api.yml => docker-images.yml} (58%) diff --git a/.github/workflows/docker-api-postgres-migration.yml b/.github/workflows/docker-api-postgres-migration.yml deleted file mode 100644 index bd68349c..00000000 --- a/.github/workflows/docker-api-postgres-migration.yml +++ /dev/null @@ -1,36 +0,0 @@ -name: Docker Image for Postgres Migration - -on: - push: - branches: - - main - paths: - - "prisma/migrations/**" - pull_request: - merge_group: - -jobs: - build: - name: Build - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3 - - uses: hadolint/hadolint-action@54c9adbab1582c2ef04b2016b760714a4bfde3cf # v3.1.0 - with: - dockerfile: Dockerfile.migration - - - uses: docker/setup-buildx-action@885d1462b80bc1c1c7f0b00334ad271f09369c55 # v2 - - uses: docker/login-action@465a07811f14bebb1938fbed4728c6a1ff8901fc # v2 - with: - registry: ghcr.io - username: ${{ github.repository_owner }} - password: ${{ secrets.GITHUB_TOKEN }} - - run: echo "LATEST_MIGRATION_NAME=$(ls -1 --ignore migration_lock.toml --reverse | head -n 1)" >> $GITHUB_ENV - - uses: docker/build-push-action@0a97817b6ade9f46837855d676c4cca3a2471fc9 # v4 - with: - cache-from: type=gha - cache-to: type=gha,mode=max - context: . - file: Dockerfile.migration - push: ${{ github.event_name == 'push' }} - tags: ghcr.io/${{ github.repository_owner }}/api-postgres-migration:${{ env.LATEST_MIGRATION_NAME }} diff --git a/.github/workflows/docker-api.yml b/.github/workflows/docker-images.yml similarity index 58% rename from .github/workflows/docker-api.yml rename to .github/workflows/docker-images.yml index 388423ef..a12f0291 100644 --- a/.github/workflows/docker-api.yml +++ b/.github/workflows/docker-images.yml @@ -1,24 +1,15 @@ -name: Docker(api) +name: Docker Images on: push: branches: - main - paths: - - "Dockerfile" - - ".dockerignore" - - "package.json" - - "package-lock.json" - - ".npmrc" - - "src/**" - - "prisma/schema.prisma" - - "codegen-plugins/**" pull_request: merge_group: jobs: - build: - name: Build api + build_api: + name: Build (api) runs-on: ubuntu-latest steps: - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 @@ -56,3 +47,28 @@ jobs: file: Dockerfile push: ${{ github.event_name == 'push' }} tags: ghcr.io/${{ github.repository_owner }}/api:${{ steps.image_tag.outputs.result }} + + build_migration: + name: Build (api-postgres-migration) + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3 + - uses: hadolint/hadolint-action@54c9adbab1582c2ef04b2016b760714a4bfde3cf # v3.1.0 + with: + dockerfile: Dockerfile.migration + + - uses: docker/setup-buildx-action@885d1462b80bc1c1c7f0b00334ad271f09369c55 # v2 + - uses: docker/login-action@465a07811f14bebb1938fbed4728c6a1ff8901fc # v2 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + - run: echo "LATEST_MIGRATION_NAME=$(ls -1 --ignore migration_lock.toml ./prisma/migrations --reverse | head -n 1)" >> $GITHUB_ENV + - uses: docker/build-push-action@0a97817b6ade9f46837855d676c4cca3a2471fc9 # v4 + with: + cache-from: type=gha + cache-to: type=gha,mode=max + context: . + file: Dockerfile.migration + push: ${{ github.event_name == 'push' }} + tags: ghcr.io/${{ github.repository_owner }}/api-postgres-migration:${{ env.LATEST_MIGRATION_NAME }}