-
Notifications
You must be signed in to change notification settings - Fork 8
60 lines (53 loc) · 1.77 KB
/
cd.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
name: Deploy image to ghcr.io
on:
push:
tags:
- v*
paths:
- cmd/**
- internal/**
- pkg/**
- Dockerfile
- .dockerignore
- .golangci.yml
- go.mod
- go.sum
jobs:
build_and_push:
runs-on: ubuntu-latest
permissions: # Permissions for GITHUB_TOKEN
contents: read
packages: write
steps:
- name: Login to dockerhub
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3
with:
username: bl4ko
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to ghcr.io
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3
with:
registry: ghcr.io
username: bl4ko
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@53851d14592bedcffcf25ea515637cff71ef929a # v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@6524bf65af31da8d45b59e8c27de4bd072b392f5 # v3
- name: Set created date for image
id: build_date
run: echo "CREATED=$(date -u +"%Y-%m-%dT%H:%M:%SZ")" >> "$GITHUB_OUTPUT"
- name: Build and push final image
uses: docker/build-push-action@ca877d9245402d1537745e0e356eab47c3520991 # v6.13.0
with:
platforms: linux/amd64,linux/arm64,linux/386,linux/arm/v6,linux/arm/v7
tags: |
bl4ko/netbox-ssot:latest
bl4ko/netbox-ssot:${{ github.ref_name }}
ghcr.io/bl4ko/netbox-ssot:latest
ghcr.io/bl4ko/netbox-ssot:${{ github.ref_name }}
push: true
build-args: |
VERSION=${{ github.ref_name }}
CREATED=${{ steps.build_date.outputs.CREATED }}
COMMIT=${{ github.sha }}