Skip to content

Commit eed5bd5

Browse files
committed
onprem - Setup publishing job after push to main
1 parent bf1c15a commit eed5bd5

File tree

1 file changed

+75
-0
lines changed

1 file changed

+75
-0
lines changed
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: Koku UI OnPrem - Push to main
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
tags:
8+
- 'onprem-*'
9+
env:
10+
QUAY_ORG: quay.io/insights-onprem
11+
QUAY_UI_REPO: koku-ui-onprem
12+
13+
jobs:
14+
generate-tags:
15+
runs-on: ubuntu-latest
16+
outputs:
17+
image_tags: ${{ steps.get-tags.outputs.image_tags }}
18+
steps:
19+
- uses: actions/checkout@v4
20+
with:
21+
fetch-depth: 0
22+
fetch-tags: true
23+
24+
- name: Generate image tags
25+
id: get-tags
26+
run: |
27+
if ${{ github.ref_type == 'tag' }}; then
28+
# The images tags will match the Release tag
29+
image_tags=( ${{ github.ref_name }} )
30+
image_tags=${image_tags#v} # remove the leading v prefix for version
31+
32+
echo "image_tags=${image_tags[@]}" >> $GITHUB_OUTPUT
33+
echo "image_tags=${image_tags[@]}"
34+
35+
else
36+
version=$(git describe --long --tags --exclude latest)
37+
version=${version#v} # remove the leading v prefix for version
38+
# The images tags are taken from git
39+
image_tags=( latest-${GITHUB_SHA} latest ${version} )
40+
echo "image_tags=${image_tags[@]}" >> $GITHUB_OUTPUT
41+
echo "image_tags=${image_tags[@]}"
42+
fi
43+
44+
publish-onprem-ui:
45+
runs-on: ubuntu-latest
46+
needs: [generate-tags]
47+
steps:
48+
- uses: actions/checkout@v4
49+
50+
- name: Build
51+
id: build
52+
uses: redhat-actions/buildah-build@v2
53+
with:
54+
image: ${{ env.QUAY_UI_REPO }}
55+
tags: ${{ needs.generate-tags.outputs.image_tags }}
56+
labels: |
57+
org.insights-onprem.koku-ui-onprem.github.repository=${{ github.repository }}
58+
org.insights-onprem.koku-ui-onprem.github.actor=${{ github.actor }}
59+
org.insights-onprem.koku-ui-onprem.github.run_id=${{ github.run_id }}
60+
org.insights-onprem.koku-ui-onprem.github.sha=${{ github.sha }}
61+
org.insights-onprem.koku-ui-onprem.github.ref_name=${{ github.ref_name }}
62+
extra-args: |
63+
--ulimit nofile=10000:10000
64+
containerfiles: apps/koku-ui-onprem/Containerfile
65+
context: .
66+
67+
- name: Push to Quay.io
68+
id: push
69+
uses: redhat-actions/[email protected]
70+
with:
71+
image: ${{ steps.build.outputs.image }}
72+
tags: ${{ needs.generate-tags.outputs.image_tags }}
73+
registry: ${{ env.QUAY_ORG }}
74+
username: ${{ secrets.QUAY_INSIGHTS_ONPREM_ROBOT_USERNAME }}
75+
password: ${{ secrets.QUAY_INSIGHTS_ONPREM_ROBOT_PASSWORD }}

0 commit comments

Comments
 (0)