From daa9b0462ac670a430086102e6cadc1230226821 Mon Sep 17 00:00:00 2001 From: Robert Jandow <38583713+robertjndw@users.noreply.github.com> Date: Tue, 4 Jun 2024 17:10:33 +0200 Subject: [PATCH] Update build.yml to use reusable workflows (#106) * Update build.yml to use reusable workflows * Update build.yml to fix naming error * Update build.yml to restrict branches for PR builds * Update build.yml to fix spacing * Update build.yml to run things sequentially * Update build.yml to fix duplicated builds * Remove tags from push options --- .github/workflows/build.yml | 54 +++++-------------------------------- 1 file changed, 7 insertions(+), 47 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1c6f5d8..1117f53 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,23 +2,19 @@ name: Build Docker Images on: pull_request: + branches: + - main + - release/* push: branches: - main - release/* - tags: '*' release: types: - created - - workflow_run: - workflows: ["Go Test"] - types: - - completed jobs: build: - runs-on: ubuntu-latest strategy: fail-fast: false matrix: @@ -29,43 +25,7 @@ jobs: image: ghcr.io/ls1intum/hades/hades-scheduler - dockerfile: ./HadesCloneContainer/Dockerfile image: ghcr.io/ls1intum/hades/hades-clone-container - - steps: - - name: Extract metadata (tags, labels) for Docker - id: meta - uses: docker/metadata-action@v5 - with: - images: ${{ matrix.image }} - tags: | - type=raw,value=latest,enable={{is_default_branch}} - type=ref,event=branch - type=ref,event=pr - - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Log in to the Container registry - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - with: - platforms: all - - - name: Install Docker Buildx - id: buildx - uses: docker/setup-buildx-action@v3 - - - name: Build and push Docker Image - uses: docker/build-push-action@v5 - with: - file: ${{ matrix.dockerfile }} - platforms: linux/amd64,linux/arm64 - push: true - tags: ${{ steps.meta.outputs.tags }} + uses: ls1intum/.github/.github/workflows/build-and-push-docker-image.yml@main + with: + image-name: ${{ matrix.image }} + docker-file: ${{ matrix.dockerfile }}