-
Notifications
You must be signed in to change notification settings - Fork 0
72 lines (68 loc) · 2.32 KB
/
pr.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
name: Deploy to OpenShift on PR
on:
pull_request:
branches:
- main
jobs:
pr-description-add:
name: PR Description Add
runs-on: ubuntu-22.04
permissions:
pull-requests: write
timeout-minutes: 1
steps:
- uses: bcgov-nr/action-pr-description-add@v1.1.2
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
add_markdown: |
---
Thanks for the PR!
Deployments, as required, will be available below:
- [Frontend](https://${{ github.event.repository.name }}-${{ github.event.number }}.apps.silver.devops.gov.bc.ca)
builds:
name: Builds
runs-on: ubuntu-22.04
permissions:
packages: write
strategy:
matrix:
package: [frontend]
include:
- package: frontend
triggers: ('patterns/')
build_file: ./patterns/Dockerfile
build_context: ./patterns
steps:
- uses: actions/checkout@v4
- uses: bcgov-nr/action-builder-ghcr@v2.2.0
with:
package: ${{ matrix.package }}
tag: pr-${{ github.event.number }}
tag_fallback: test
token: ${{ secrets.GITHUB_TOKEN }}
triggers: ${{ matrix.triggers }}
build_context: ${{ matrix.build_context }}
build_file: ${{ matrix.build_file }}
deploys:
name: Deploys
needs: [builds]
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
name: Checkout
- name: Deploy to OpenShift
shell: bash
run: |
# Allow pipefail, since we could be catching oc create errors
set +o pipefail
# Login to OpenShift (NOTE: project command is a safeguard)
oc login --token=${{ secrets.oc_token }} --server=${{ vars.oc_server }}
oc project ${{ vars.oc_namespace }}
helm uninstall ${{ github.event.repository.name }}-${{ github.event.number }} || true
# Deploy Helm Chart
cd charts/${{ github.event.repository.name }}
helm dependency update
helm upgrade --install --wait --atomic ${{ github.event.repository.name }}-${{ github.event.number }} \
--set-string global.tag="pr-${{ github.event.number }}" \
--set-string global.repository="${{ github.repository }}" \
-f values.yaml --timeout 5m .