From c894d23e93bca477315243e9cb01b02c12d5be06 Mon Sep 17 00:00:00 2001 From: "Alex.Bob" Date: Thu, 12 Dec 2024 15:50:00 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=80=20chore(`.github/workflows/postgre?= =?UTF-8?q?s-build.yml`):=20Update=20GitHub=20Actions=20workflow=20for=20D?= =?UTF-8?q?ocker=20image=20builds=20and=20registry=20login.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/postgres-build.yml | 53 ++++++++-------------------- 1 file changed, 15 insertions(+), 38 deletions(-) diff --git a/.github/workflows/postgres-build.yml b/.github/workflows/postgres-build.yml index ffe173e5..9cd13283 100644 --- a/.github/workflows/postgres-build.yml +++ b/.github/workflows/postgres-build.yml @@ -27,51 +27,28 @@ jobs: attestations: write id-token: write steps: - - uses: actions/checkout@v4 + - name: Checkout repository + uses: actions/checkout@v4 + - name: Docker Setup Buildx - # You may pin to the exact commit or the version. - # uses: docker/setup-buildx-action@c47758b77c9736f4b2ef4073d4d51994fabfe349 uses: docker/setup-buildx-action@v3.7.1 - #with: - # Buildx version. (eg. v0.3.0) - #version: # optional - # Sets the builder driver to be used - #driver: # optional, default is docker-container - # List of additional driver-specific options. (eg. image=moby/buildkit:master) - #driver-opts: # optional - # BuildKit daemon flags - #buildkitd-flags: # optional - # BuildKit daemon config file - #buildkitd-config: # optional - # Inline BuildKit daemon config - #buildkitd-config-inline: # optional - # Sets up docker build command as an alias to docker buildx build - #install: # optional, default is false - # Switch to this builder instance - #use: # optional, default is true - # Optional address for docker socket or context from `docker context ls` - #endpoint: # optional - # Fixed platforms for current node. If not empty, values take priority over the detected ones - #platforms: # optional - # Append additional nodes to the builder - #append: # optional - # Cache buildx binary to GitHub Actions cache backend - #cache-binary: # optional, default is true - # Cleanup temp files and remove builder at the end of a job - #cleanup: # optional, default is true - # BuildKit daemon config file - #config: # optional - # Inline BuildKit daemon config - #config-inline: # optional + + - name: Log into registry ${{ env.REGISTRY }} + if: github.event_name != 'pull_request' + uses: docker/login-action@v3.3.0 + with: + registry: ${{ env.REGISTRY }} + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} - name: Build Local Docker image - run: docker buildx build -t ${{ vars.DOCKER_PREFIX }}/postgres:17 ./boot/postgres + run: docker buildx build --push -t ${{ vars.DOCKER_PREFIX }}/postgres:17 ./boot/postgres - name: Build zhparser Docker image - run: docker buildx build -t ${{ vars.DOCKER_PREFIX }}/postgres:zhparser ./boot/postgres/zhparser + run: docker buildx build --push -t ${{ vars.DOCKER_PREFIX }}/postgres:zhparser ./boot/postgres/zhparser - name: Build postgis Docker image - run: docker buildx build -t ${{ vars.DOCKER_PREFIX }}/postgres:postgis ./boot/postgres/postgis + run: docker buildx build --push -t ${{ vars.DOCKER_PREFIX }}/postgres:postgis ./boot/postgres/postgis - name: Build latest Docker image - run: docker buildx build -t ${{ vars.DOCKER_PREFIX }}/postgres:latest ./boot/postgres/postgis + run: docker buildx build --push -t ${{ vars.DOCKER_PREFIX }}/postgres:latest ./boot/postgres/postgis