|
| 1 | +name: main |
| 2 | + |
| 3 | +concurrency: |
| 4 | + group: ${{ github.workflow }}-${{ github.ref_name }} |
| 5 | + cancel-in-progress: true |
| 6 | + |
| 7 | +on: |
| 8 | + push: |
| 9 | + tags: [ 'v*.*.*' ] |
| 10 | + branches: [ 'main' ] |
| 11 | + |
| 12 | +env: |
| 13 | + REGISTRY: ghcr.io |
| 14 | + |
| 15 | +jobs: |
| 16 | + docker: |
| 17 | + runs-on: |
| 18 | + - self-hosted |
| 19 | + - ${{ matrix.runner }} |
| 20 | + permissions: |
| 21 | + contents: read |
| 22 | + packages: write |
| 23 | + id-token: write |
| 24 | + strategy: |
| 25 | + matrix: |
| 26 | + include: |
| 27 | + - docker_file: Dockerfile |
| 28 | + name: pipeline-watchdog-arm64 |
| 29 | + arch: linux/arm64 |
| 30 | + tag: ghcr.io/insight-platform/pipeline-watchdog-arm64 |
| 31 | + runner: ARM64 |
| 32 | + - docker_file: Dockerfile |
| 33 | + name: pipeline-watchdog-x86 |
| 34 | + arch: linux/amd64 |
| 35 | + tag: ghcr.io/insight-platform/pipeline-watchdog-x86 |
| 36 | + runner: X64 |
| 37 | + |
| 38 | + steps: |
| 39 | + - name: Checkout repository |
| 40 | + uses: actions/checkout@v4 |
| 41 | + |
| 42 | + - name: Inject slug/short variables |
| 43 | + uses: rlespinasse/github-slug-action@v4.4.1 |
| 44 | + |
| 45 | + # Set up BuildKit Docker container builder to be able to build |
| 46 | + # multi-platform images and export cache |
| 47 | + # https://github.com/docker/setup-buildx-action |
| 48 | + - name: Set up Docker Buildx |
| 49 | + uses: docker/setup-buildx-action@v3.5.0 |
| 50 | + |
| 51 | + # https://github.com/docker/build-push-action |
| 52 | + - name: Build docker image for ${{ env.GITHUB_REF_SLUG }} |
| 53 | + uses: docker/build-push-action@v6.5.0 |
| 54 | + with: |
| 55 | + file: ${{ matrix.docker_file }} |
| 56 | + platforms: ${{ matrix.arch }} |
| 57 | + tags: "${{matrix.tag}}:${{ env.GITHUB_REF_SLUG }}" |
| 58 | + load: true |
| 59 | + context: . |
| 60 | + cache-from: type=gha |
| 61 | + cache-to: type=gha,mode=max |
| 62 | + |
| 63 | + # https://github.com/docker/login-action |
| 64 | + - name: Log into registry ${{ env.REGISTRY }} |
| 65 | + uses: docker/login-action@v3.3.0 |
| 66 | + with: |
| 67 | + registry: ${{ env.REGISTRY }} |
| 68 | + username: ${{ github.actor }} |
| 69 | + password: ${{ github.token }} |
| 70 | + |
| 71 | + # https://github.com/docker/build-push-action |
| 72 | + - name: Push docker image for ${{ env.GITHUB_REF_SLUG }} |
| 73 | + uses: docker/build-push-action@v6.5.0 |
| 74 | + with: |
| 75 | + file: ${{ matrix.docker_file }} |
| 76 | + platforms: ${{ matrix.arch }} |
| 77 | + tags: "${{matrix.tag}}:${{ env.GITHUB_REF_SLUG }}" |
| 78 | + push: true |
| 79 | + context: . |
| 80 | + cache-from: type=gha |
| 81 | + cache-to: type=gha,mode=max |
0 commit comments