-
Notifications
You must be signed in to change notification settings - Fork 3
64 lines (61 loc) · 2.22 KB
/
release.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
58
59
60
61
62
63
64
name: Add Tags to Release
on:
release:
types: [published]
jobs:
build-if-needed:
if: github.repository == 'rht-labs/lodestar-engagements'
runs-on: ubuntu-latest
steps:
- name: Check whether we need to build this or not
id: need_to_build
run: |
function image_exists() {
curl --silent -f -lSL https://quay.io/v1/repositories/${{ github.repository }}/tags/$1 > /dev/null
}
if image_exists ${{ github.sha }}; then
echo "Image ${{ github.sha }} exists - not building"
echo ::set-output name=need_to_build::0
else
echo "Image ${{ github.sha }} needs to be built"
echo ::set-output name=need_to_build::1
fi
- uses: actions/checkout@v2
if: steps.need_to_build.outputs.need_to_build == 1
- name: Find and Replace Commit
if: steps.need_to_build.outputs.need_to_build == 1
uses: jacobtomlinson/[email protected]
with:
find: "###GIT_COMMIT###"
replace: "${{ github.sha }}"
include: ".s2i"
- uses: redhat-cop/github-actions/s2i@v2
if: steps.need_to_build.outputs.need_to_build == 1
with:
base: registry.access.redhat.com/ubi8/openjdk-11:1.10
output_image: "quay.io/${{ github.repository }}:${{ github.sha }}"
image_push_registry: quay.io
image_push_username: ${{ secrets.QUAY_USERNAME }}
image_push_password: ${{ secrets.QUAY_PASSWORD }}
release:
runs-on: ubuntu-latest
needs: build-if-needed
steps:
- uses: actions/checkout@v2
- name: tag with release version
uses: tinact/[email protected]
with:
image_name: ${{ github.repository }}
image_old_tag: ${{ github.sha }}
image_new_tag: ${{ github.event.release.tag_name }}
registry: quay.io
registry_username: ${{ secrets.QUAY_USERNAME }}
registry_password: ${{ secrets.QUAY_PASSWORD }}
- name: tag with latest
uses: tinact/[email protected]
with:
image_name: ${{ github.repository }}
image_old_tag: ${{ github.sha }}
registry: quay.io
registry_username: ${{ secrets.QUAY_USERNAME }}
registry_password: ${{ secrets.QUAY_PASSWORD }}