-
Notifications
You must be signed in to change notification settings - Fork 24
72 lines (60 loc) · 1.91 KB
/
build-and-publish.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
---
name: Build and Publish
on:
push:
tags:
- 'v*'
branches:
- main
workflow_dispatch:
jobs:
build-and-publish:
name: Publish container image
env:
IMAGE_REGISTRY: quay.io/navidys
IMAGE_NAMESPACE: ${{ github.event.repository.name }}
runs-on: 'ubuntu-latest'
steps:
- name: Check out the repo
uses: actions/checkout@v2
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: '>=1.22'
- name: Build binary
run: |
make binary-remote-amd64
make binary-remote-s390x
make binary-remote-ppc64le
make binary-remote-arm64
- name: Get image tags
id: image_tag
run: |
echo -n ::set-output name=IMAGE_TAG::
VERSION=$(grep 'VERSION=' VERSION | awk -F= '{print $2'})
REVISION=$(grep 'REVISION=' VERSION | awk -F= '{print $2'})
if [[ "${REVISION}" =~ "dev." ]] ; then
echo "${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_NAMESPACE }}:develop"
else
echo "${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_NAMESPACE }}:v${VERSION},${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_NAMESPACE }}:latest"
fi
- name: Set up qemu
uses: docker/setup-qemu-action@v3
- name: Set up buildx
uses: docker/setup-buildx-action@v3
- name: Login to Quay.io
uses: docker/login-action@v3
with:
registry: ${{ env.IMAGE_REGISTRY }}
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Build container image
uses: docker/build-push-action@v5
id: build_image
with:
context: .
platforms: linux/amd64,linux/s390x,linux/ppc64le,linux/arm64,
push: true
provenance: false
file: "Containerfile"
tags: ${{ steps.image_tag.outputs.IMAGE_TAG }}