-
Notifications
You must be signed in to change notification settings - Fork 45
Expand file tree
/
Copy pathbuild-contributor-container-PR.yml
More file actions
69 lines (60 loc) · 2.3 KB
/
Copy pathbuild-contributor-container-PR.yml
File metadata and controls
69 lines (60 loc) · 2.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
name: 'Build Contributor container (PR)'
# For speedup to do this in parallel: https://docs.docker.com/build/ci/github-actions/multi-platform/
# Loosely based on: https://docs.docker.com/build/ci/github-actions/push-multi-registries/
on:
merge_group:
# We can't limit the files as below as this is a required check so should run
# We exit early in case no relevant file changed
types: [checks_requested]
pull_request:
branches:
- main
push:
# We don't start the job if no relevant file changed
paths:
# This is an `either`, so any file listed here will trigger
- docker-contributor/**
- .github/workflows/build-contributor-container-PR.yml
jobs:
pr-contributor:
name: PR Contributor image
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Detect changed files and compute condition
id: filter
uses: ./.github/actions/helper-detect-changed-files
with:
trigger-files: "docker-contributor .github/workflows/build-contributor-container-PR"
- name: Mark as skipped
if: steps.filter.outputs.should_run == 'false'
run: echo "Skip job, no important files changed"
- name: Set up QEMU
if: steps.filter.outputs.should_run == 'true'
uses: docker/setup-qemu-action@v4
- name: Set up Docker Buildx
if: steps.filter.outputs.should_run == 'true'
uses: docker/setup-buildx-action@v4
- name: Login to GitHub container registry
if: steps.filter.outputs.should_run == 'true'
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
if: steps.filter.outputs.should_run == 'true'
id: meta
uses: docker/metadata-action@v6
with:
images: ghcr.io/${{ github.repository }}
- name: Build and push
if: steps.filter.outputs.should_run == 'true'
uses: docker/build-push-action@v7
with:
context: docker-contributor
platforms: linux/amd64,linux/arm64
push: false
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}