-
Notifications
You must be signed in to change notification settings - Fork 25
57 lines (47 loc) · 1.53 KB
/
docker-publish.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
name: Docker
on:
push:
branches: [ "main" ]
workflow_dispatch:
inputs:
tagName:
description: 'Tag Name'
required: true
default: 'latest'
jobs:
build:
name: docker-ci
runs-on: ubuntu-20.04
permissions:
packages: write
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- uses: actions/setup-go@v3
with:
go-version: '>=1.19.0'
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build the kube-loxilb image
run: make
- name: Build the latest loxilb Docker image
if: github.event.inputs.tagName == ''
run: docker build . --tag ghcr.io/loxilb-io/kube-loxilb:latest
- name: Build the kube-loxilb Docker image with given tag
if: github.event.inputs.tagName != ''
run: docker build . --tag ghcr.io/loxilb-io/kube-loxilb:${{ github.event.inputs.tagName }}
- name: Publish the latest loxilb Docker image
if: |
github.repository == 'loxilb-io/kube-loxilb'
&& github.event.inputs.tagName == ''
run: docker push ghcr.io/loxilb-io/kube-loxilb:latest
- name: Publish the kube-loxilb Docker image with given tag
if: |
github.repository == 'loxilb-io/kube-loxilb'
&& github.event.inputs.tagName != ''
run: docker push ghcr.io/loxilb-io/kube-loxilb:${{ github.event.inputs.tagName }}