-
Notifications
You must be signed in to change notification settings - Fork 0
74 lines (64 loc) · 2.21 KB
/
build.yaml
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
72
73
74
name: Build and push
on:
workflow_dispatch:
pull_request:
branches:
- main
push:
branches:
- main
env:
IMAGE_NAME: vonwig/adm-ctrl
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
# Workaround: https://github.com/docker/build-push-action/issues/461
- name: Setup Docker buildx
uses: docker/setup-buildx-action@79abd3f86f79a9d68a23c75a09a9a85889262adf
- name: Log into registry ${{ env.REGISTRY }} with write access
uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c
with:
username: jimclark106
password: ${{ secrets.DOCKER_PAT }}
- name: Find new version
id: new_version
uses: mathieudutour/github-tag-action@v6.1
with:
dry_run: true
release_branches: main
github_token: ${{ secrets.GITHUB_TOKEN }}
# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: ${{ env.IMAGE_NAME }}
labels: |
org.opencontainers.image.revision=${{ env.SHA }}
tags: |
latest
${{ steps.new_version.outputs.new_tag }}
# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push admission controller
id: build-and-push-controller
uses: docker/build-push-action@ac9327eae2b366085ac7f6a2d02df8aa8ead720a
with:
context: .
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Tag version
uses: mathieudutour/github-tag-action@v6.1
if : ${{ github.event_name != 'pull_request' }}
with:
custom_tag: ${{ steps.new_version.outputs.new_version }}
release_branches: main
github_token: ${{ secrets.GITHUB_TOKEN }}