-
Notifications
You must be signed in to change notification settings - Fork 24
65 lines (55 loc) · 1.68 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
---
name: Build and Publish
on:
push:
tags:
- 'v*'
branches:
- main
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.18"
- name: Build binary
run: |
make binary-remote
- 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 "develop"
else
echo "v${VERSION} latest"
fi
- name: Build container image
uses: redhat-actions/buildah-build@v2
id: build_image
with:
image: ${{ env.IMAGE_NAMESPACE }}
tags: "${{ steps.image_tag.outputs.IMAGE_TAG }}"
containerfiles: |
./Containerfile
- name: Publish container image
id: push_to_quay
uses: redhat-actions/push-to-registry@v2
with:
image: ${{ steps.build_image.outputs.image }}
tags: ${{ steps.build_image.outputs.tags }}
registry: ${{ env.IMAGE_REGISTRY }}
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Print image url
run: echo "Image pushed to ${{ steps.push_to_quay.outputs.registry-paths }}"