-
Notifications
You must be signed in to change notification settings - Fork 39
93 lines (84 loc) · 2.98 KB
/
push-to-master.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
name: Push to master or release tag
on:
push:
branches:
- master
tags:
- 'v*'
- '!v*-cim'
env:
QUAY_ORG: quay.io/edge-infrastructure
QUAY_REPO: assisted-installer-ui
jobs:
preflight-check:
# Prevents running the workflow when a brand-new tag points to the same commit as the master branch
runs-on: ubuntu-latest
outputs:
skip: ${{ steps.check.outputs.skip }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Check if a tag points to the same commit as the master branch
id: check
run: |
if [[ "${GITHUB_REF_TYPE}" == "tag" ]] && [[ "${GITHUB_SHA}" == "$(git rev-parse origin/master)" ]]; then
skip=true
else
skip=false
fi
echo "skip=${skip}" >> $GITHUB_OUTPUT
echo "skip=${skip}"
publish-assisted-ui:
needs: preflight-check
if: needs.preflight-check.outputs.skip == 'false'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Generate AIUI_APP_VERSION
run: |
AIUI_APP_VERSION=latest
if [[ "${GITHUB_REF_TYPE}" == "tag" ]]; then
AIUI_APP_VERSION=${GITHUB_REF_NAME}
fi
echo "AIUI_APP_VERSION=${AIUI_APP_VERSION}" >> $GITHUB_ENV
echo "AIUI_APP_VERSION=${AIUI_APP_VERSION}"
- name: Generate tags
id: generate-tags
run: |
tags=( latest-${GITHUB_SHA} latest )
if [[ "${GITHUB_REF_TYPE}" == "tag" ]]; then
tags+=( ${GITHUB_REF_NAME} )
if [[ ! "${GITHUB_REF_NAME}" =~ -cim$ ]]; then
tags+=( staging-released )
fi
fi
echo "tags=${tags[@]}" >> $GITHUB_OUTPUT
echo "tags=${tags[@]}"
- name: Build
id: build
uses: redhat-actions/buildah-build@v2
with:
image: ${{ env.QUAY_REPO }}
tags: ${{ steps.generate-tags.outputs.tags }}
labels: |
org.openshift-assisted.github.repository=${{ github.repository }}
org.openshift-assisted.github.actor=${{ github.actor }}
org.openshift-assisted.github.run_id=${{ github.run_id }}
org.openshift-assisted.github.sha=${{ github.sha }}
org.openshift-assisted.github.ref_name=${{ github.ref_name }}
build-args: |
AIUI_APP_VERSION=${{ env.AIUI_APP_VERSION }}
AIUI_APP_GIT_SHA=${{ github.sha }}
AIUI_APP_IMAGE_REPO=${{ env.QUAY_ORG }}/${{ env.QUAY_REPO }}
containerfiles: apps/assisted-ui/Containerfile
context: .
- name: Push to Quay.io
id: push
uses: redhat-actions/[email protected]
with:
image: ${{ steps.build.outputs.image }}
tags: ${{ steps.build.outputs.tags }}
registry: ${{ env.QUAY_ORG }}
username: ${{ secrets.QUAY_EDGE_INFRA_ROBOT_USERNAME }}
password: ${{ secrets.QUAY_EDGE_INFRA_ROBOT_PASSWORD }}