-
Notifications
You must be signed in to change notification settings - Fork 15
41 lines (35 loc) · 1.18 KB
/
oc_deploy.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
name: Deploy Me to OpenShift
on:
workflow_dispatch:
inputs:
s2iBuilder:
description: 'OpenShift S2I Builder Image Name'
required: true
default: 'java:openjdk-17-ubi8'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Install OpenShift CLI
uses: redhat-actions/oc-installer@v1
- name: Authenticate with OpenShift
uses: redhat-actions/oc-login@v1
with:
openshift_server_url: ${{ secrets.OCP_SERVER }}
openshift_username: ${{ secrets.OCP_USER }}
openshift_password: ${{ secrets.OCP_PASSWORD }}
insecure_skip_tls_verify: true
- name: Install App from Source
shell: bash
run: |
repo=${{ github.repository }}
_repoUrl=${{ github.repositoryUrl }}
repoUrl=https:${_repoUrl##git:}
oc new-project ${repo##*/} || true
if ! oc -n ${repo##*/} new-app --name=${repo##*/} ${{ github.event.inputs.s2iBuilder }}~${repoUrl} --strategy=source >log 2>&1; then
oc -n ${repo##*/} start-build ${repo##*/}
fi