-
Notifications
You must be signed in to change notification settings - Fork 3
84 lines (73 loc) · 2.56 KB
/
build-deploy.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
name: Build and Deploy
on:
push:
branches:
- master
env:
APPUIO_PROJECT_NAME: vshn-docs
IMAGE_NAME: appcat-user-docs
IMAGE_REGISTRY: ghcr.io/${{ github.repository_owner }}
REGISTRY_USER: ${{ github.actor }}
REGISTRY_PASSWORD: ${{ github.token }}
jobs:
build:
name: Build Antora Site 🏗️
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build Antora Site
id: build_site
uses: redhat-actions/buildah-build@v2
with:
image: ${{ env.IMAGE_NAME }}-site
tags: latest
containerfiles: |
./deployment/main/Containerfile
oci: true
- name: Build Antora Search Index
id: build_search
uses: redhat-actions/buildah-build@v2
with:
image: ${{ env.IMAGE_NAME }}-search
tags: latest
containerfiles: |
./deployment/search/Containerfile
oci: true
- name: Push Antora Site Image
uses: redhat-actions/push-to-registry@v2
with:
image: ${{ steps.build_site.outputs.image }}
tags: ${{ steps.build_site.outputs.tags }}
registry: ${{ env.IMAGE_REGISTRY }}
username: ${{ env.REGISTRY_USER }}
password: ${{ env.REGISTRY_PASSWORD }}
- name: Push Search Image
uses: redhat-actions/push-to-registry@v2
with:
image: ${{ steps.build_search.outputs.image }}
tags: ${{ steps.build_search.outputs.tags }}
registry: ${{ env.IMAGE_REGISTRY }}
username: ${{ env.REGISTRY_USER }}
password: ${{ env.REGISTRY_PASSWORD }}
deploy:
name: Deploy Antora Site 🚀
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v3
- name: Install OpenShift CLI tools
uses: redhat-actions/openshift-tools-installer@v1
with:
oc: "latest"
- name: Authenticate and set context
uses: redhat-actions/oc-login@v1
with:
openshift_server_url: ${{ secrets.OPENSHIFT_SERVER }}
openshift_token: ${{ secrets.OPENSHIFT_TOKEN }}
namespace: ${{ env.APPUIO_PROJECT_NAME }}
- name: Apply Manifests
run: |
sed -i "s#SITEIMAGE#ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}-site:latest#" deployment/deployment.yaml
sed -i "s#SEARCHIMAGE#ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}-search:latest#" deployment/deployment.yaml
sed -i "s#GITSHAFULL#$GITHUB_SHA#" deployment/deployment.yaml
oc apply -f deployment/