-
Notifications
You must be signed in to change notification settings - Fork 0
71 lines (60 loc) · 1.92 KB
/
pr.yml
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
70
71
name: PR Build
on:
pull_request:
branches:
- main
permissions:
contents: write
pull-requests: write
jobs:
create_matrix:
uses: ./.github/workflows/create_matrix.yml
with:
image_directory: "./images"
build:
runs-on: ubuntu-latest
needs: create_matrix
strategy:
matrix:
image_folder: ${{fromJson(needs.create_matrix.outputs.matrix)}}
services:
registry:
image: registry:2
ports:
- 5000:5000
steps:
- name: Checkout code
uses: actions/[email protected]
- name: Set Image Name output
run: echo "image_name=$(python3 -c "print('${{ matrix.image_folder }}'.split('/')[-1])")" >> $GITHUB_OUTPUT
id: set_image_name
- name: Set up Docker
uses: docker/setup-buildx-action@v3
with:
driver-opts: network=host
- name: Build and push to GHA
uses: docker/build-push-action@v5
with:
context: ${{ matrix.image_folder }}/.
push: true
tags: localhost:5000/${{ steps.set_image_name.outputs.image_name }}:latest
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Check build status
run: docker run --rm localhost:5000/${{ steps.set_image_name.outputs.image_name }}:latest
dependabot:
runs-on: ubuntu-latest
if: github.actor == 'dependabot[bot]'
needs: build
steps:
- name: Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@v2
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
- name: Enable auto-merge for Dependabot PRs
if: contains(steps.metadata.outputs.dependency-names, 'docker') && steps.metadata.outputs.update-type == 'version-update:semver-patch'
run: gh pr merge --auto --merge "$PR_URL"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}