-
Notifications
You must be signed in to change notification settings - Fork 22
96 lines (95 loc) · 3.04 KB
/
catalog-ui-pr.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
94
95
96
name: Catalog UI - PR Workflow
on:
push:
paths:
- catalog/**
branches:
- main
pull_request:
paths:
- catalog/**
branches:
- main
jobs:
test:
name: "UI Tests"
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: ["ubuntu-latest"]
node: ["14"]
steps:
- uses: actions/checkout@v2
- name: Setup node
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node }}
cache: "npm"
cache-dependency-path: ./catalog/ui/package-lock.json
- name: Install npm@8
working-directory: ./catalog/ui
run: npm i -g npm@8
- name: Install packages
working-directory: ./catalog/ui
run: npm ci --prefer-offline
- name: Run integration tests
working-directory: ./catalog/ui
run: npm run test
shell: bash
deploy:
needs: test
name: "Deploy on OpenShift (BabyDev)"
if: ${{ github.actor != 'dependabot[bot]' }}
runs-on: ubuntu-latest
env:
APP_NAME: babylon-catalog-ui
CONTAINER_NAME: ui
IMAGE_TAGS: ${{ secrets.REGISTRY_URI }}/${{ secrets.GPTE_REGISTRY_REPOSITORY }}/babylon-catalog-ui:${{ github.sha }}
steps:
- uses: actions/checkout@v2
- name: Set up buildx
uses: docker/setup-buildx-action@v1
if: env.IMAGE_TAGS
- name: Login to redhat.io registry
uses: docker/login-action@v1
if: env.IMAGE_TAGS
with:
registry: ${{ secrets.REDHAT_REGISTRY_URI }}
username: ${{ secrets.REDHAT_REGISTRY_USERNAME }}
password: ${{ secrets.REDHAT_REGISTRY_PASSWORD }}
- name: Login to quay.io registry
uses: docker/login-action@v1
if: env.IMAGE_TAGS
with:
registry: ${{ secrets.REGISTRY_URI }}
username: ${{ secrets.GPTE_REGISTRY_USERNAME }}
password: ${{ secrets.GPTE_REGISTRY_PASSWORD }}
- name: Build and publish image
uses: docker/build-push-action@v2
if: env.IMAGE_TAGS
with:
registry: ${{ secrets.REGISTRY_URI }}
context: catalog/ui
file: catalog/ui/Dockerfile
build-args: |
STATUS_PAGE_ID=m7thn7y0z176
MONITOR_ENABLED=false
TRACKING_ENABLED=false
OPTIONAL_FLAGS=default
push: true
tags: ${{ env.IMAGE_TAGS }}
# images from a PR expire after 14d
labels: |
quay.expires-after=14d
- name: Log in to OpenShift
if: env.IMAGE_TAGS
uses: redhat-actions/oc-login@v1
with:
openshift_server_url: ${{ secrets.OPENSHIFT_BABYDEV_SERVER }}
openshift_token: ${{ secrets.OPENSHIFT_BABYDEV_TOKEN }}
insecure_skip_tls_verify: true
namespace: ${{ secrets.OPENSHIFT_BABYDEV_NAMESPACE }}
- name: Deploy
if: env.IMAGE_TAGS
run: |
"${GITHUB_WORKSPACE}/.github/update-deployment.sh" ${{ env.APP_NAME }} ${{ env.IMAGE_TAGS }} ${{ secrets.OPENSHIFT_BABYDEV_NAMESPACE }} ${{ env.CONTAINER_NAME }}