-
Notifications
You must be signed in to change notification settings - Fork 1
79 lines (79 loc) · 2.34 KB
/
address-service.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
name: address-service build
on:
push:
paths:
- "address-service/src/**/*.js"
- "address-service/package*.json"
workflow_dispatch:
env:
NAMESPACE: f0463d-tools
BUILD_NAME: address-service-main-build
IMAGE_NAME: address-service
SOURCE_IMAGE_TAG: latest
TARGET_IMAGE_TAG: dev
jobs:
test:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./address-service
steps:
- uses: actions/checkout@main
- uses: actions/setup-node@main
with:
node-version: "12"
- name: Install dependencies
run: npm ci
# - name: Unit tests w/ coverage
# run: npm run test:coverage
- name: LINTing
run: npm run test:lint
# - name: OpenAPI Schema
# run: npm run test:schema
build:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./address-service
needs: [test]
strategy:
matrix:
node-version: [12.x]
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Cache node modules
uses: actions/cache@v1
with:
path: node_modules
key: ${{ runner.OS }}-build-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.OS }}-build-${{ env.cache-name }}-
${{ runner.OS }}-build-
${{ runner.OS }}-
- name: npm install and build
run: |
npm ci
npm run build --if-present
env:
CI: "true"
s2i-build:
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
needs: [test, build]
steps:
- uses: redhat-actions/openshift-tools-installer@v1
with:
source: "mirror"
oc: "latest"
- name: Log in to Openshift
run: oc login --token=${{ secrets.OpenShiftToken }} --server=${{ secrets.OpenShiftServerURL}}
- name: Generate Image Build
run: oc start-build ${BUILD_NAME} -n ${NAMESPACE} --follow
- name: Time delay
# to give time for Openshift to process the build so it doesn't tag the wrong image
run: sleep 20s
- name: Tag Image Build
run: oc tag -n ${NAMESPACE} ${NAMESPACE}/${IMAGE_NAME}:${SOURCE_IMAGE_TAG} ${NAMESPACE}/${IMAGE_NAME}:${TARGET_IMAGE_TAG}