Skip to content

Commit ea45e0f

Browse files
authored
Merge pull request #18 from jotak/release-action
Add release action
2 parents b6c7a34 + 87b7b14 commit ea45e0f

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed

.github/workflows/release.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: release to quay.io
2+
on:
3+
push:
4+
tags: [v*]
5+
6+
env:
7+
REGISTRY_USER: netobserv+github_ci
8+
REGISTRY_PASSWORD: ${{ secrets.QUAY_SECRET }}
9+
REGISTRY: quay.io/netobserv
10+
IMAGE: netobserv-ebpf-agent
11+
IMAGE_ORG: netobserv
12+
13+
jobs:
14+
push-image:
15+
name: push image
16+
runs-on: ubuntu-20.04
17+
strategy:
18+
matrix:
19+
go: ['1.17']
20+
steps:
21+
- name: checkout
22+
uses: actions/checkout@v2
23+
- name: validate tag
24+
id: validate_tag
25+
run: |
26+
tag=`git describe --exact-match --tags 2> /dev/null`
27+
if [[ $tag =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-rc[0-9]+)?$ ]]; then
28+
echo "$tag is a valid release tag"
29+
set -e
30+
echo "::set-output name=tag::$tag"
31+
else
32+
echo "$tag is NOT a valid release tag"
33+
exit 1
34+
fi
35+
- name: install make
36+
run: sudo apt-get install make
37+
- name: set up go 1.x
38+
uses: actions/setup-go@v2
39+
with:
40+
go-version: ${{ matrix.go }}
41+
- name: build images
42+
run: SW_VERSION="${{ steps.validate_tag.outputs.tag }}" make image-build
43+
- name: podman login to quay.io
44+
uses: redhat-actions/podman-login@v1
45+
with:
46+
username: ${{ env.REGISTRY_USER }}
47+
password: ${{ env.REGISTRY_PASSWORD }}
48+
registry: quay.io
49+
- name: push to quay.io
50+
id: push-to-quay
51+
uses: redhat-actions/push-to-registry@v2
52+
with:
53+
image: ${{ env.IMAGE }}
54+
tags: ${{ steps.validate_tag.outputs.tag }}
55+
registry: ${{ env.REGISTRY }}
56+
- name: print image url
57+
run: echo "Image pushed to ${{ steps.push-to-quay.outputs.registry-paths }}"

0 commit comments

Comments
 (0)