-
Notifications
You must be signed in to change notification settings - Fork 1
58 lines (56 loc) · 1.88 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
name: Build
on:
push:
branches: [main]
pull_request:
jobs:
docker:
runs-on: ubuntu-latest
env:
# renovate: datasource=docker depName=docker.io/netboxcommunity/netbox
NETBOX_VERSION: v4.0.9
steps:
- uses: actions/checkout@v4
if: github.event_name == 'push'
with:
fetch-depth: 0
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v44
with:
since_last_remote_commit: true
files: |
.github/workflows/build.yaml
docker/*
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
if: steps.changed-files.outputs.any_changed == 'true'
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
if: steps.changed-files.outputs.any_changed == 'true'
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
if: steps.changed-files.outputs.any_changed == 'true'
with:
images: ghcr.io/ffddorf/netbox-kubernetes
tags: |
type=raw,value=${{ env.NETBOX_VERSION }},enable={{is_default_branch}}
type=sha,prefix=${{ env.NETBOX_VERSION }}-,format=short
- name: Login to GHCR
uses: docker/login-action@v3
if: steps.changed-files.outputs.any_changed == 'true'
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v6
if: steps.changed-files.outputs.any_changed == 'true'
with:
context: "{{defaultContext}}:docker"
build-args: NETBOX_VERSION=${{ env.NETBOX_VERSION }}
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}