-
Notifications
You must be signed in to change notification settings - Fork 0
86 lines (81 loc) · 2.77 KB
/
Copy pathon-pr-opened.yaml
File metadata and controls
86 lines (81 loc) · 2.77 KB
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
name: Pull Request Opened
env:
ACRONYM: pcns
APP_NAME: nr-permitconnect-navigator-service
NAMESPACE_PREFIX: d9d78e
on:
pull_request:
branches:
- master
- "feature/**"
- "release/**"
types:
- opened
- reopened
- synchronize
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
name: Build & Push
if: "! github.event.pull_request.head.repo.fork"
permissions:
contents: read
packages: write
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Build & Push
uses: ./.github/actions/build-push-container
with:
context: .
image_name: ${{ env.APP_NAME }}
github_username: ${{ github.repository_owner }}
github_token: ${{ secrets.GITHUB_TOKEN }}
deploy-pr-dev:
name: Deploy Pull Request to Dev
environment:
name: pr
url: https://${{ env.ACRONYM }}-dev-pr-${{ github.event.number }}.apps.silver.devops.gov.bc.ca
runs-on: ubuntu-latest
needs: build
timeout-minutes: 12
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Login to OpenShift Cluster
uses: bcgov/action-oc-runner@d2fc921aaa9d70684c186dbb7754e6985d44d86f # v1.4.1
with:
oc_server: ${{ secrets.OPENSHIFT_SERVER }}
oc_token: ${{ secrets.OPENSHIFT_TOKEN }}
oc_namespace: ${{ env.NAMESPACE_PREFIX }}-dev
- name: Deploy to Dev
uses: ./.github/actions/deploy-to-environment
with:
app_name: ${{ env.APP_NAME }}
acronym: ${{ env.ACRONYM }}
environment: pr
job_name: pr-${{ github.event.number }}
namespace_prefix: ${{ env.NAMESPACE_PREFIX }}
namespace_environment: dev
openshift_server: ${{ secrets.OPENSHIFT_SERVER }}
openshift_token: ${{ secrets.OPENSHIFT_TOKEN }}
- name: Run database seeds
shell: bash
run: |
kubectl exec $(oc get pods --selector='app.kubernetes.io/instance=pr-${{ github.event.number }},app.kubernetes.io/name=nr-permitconnect-navigator-service' -o custom-columns=POD:.metadata.name --no-headers | head -1) -- \
/usr/local/bin/node \
./node_modules/knex/bin/cli.js \
seed:run \
--specific=dev_groups.js \
--knexfile=./sbin/knexfile.js
- name: Release Comment on PR
uses: marocchino/sticky-pull-request-comment@70d2764d1a7d5d9560b100cbea0077fc8f633987 # v3.0.2
if: success()
with:
header: release
message: |
Release ${{ github.sha }} deployed at <https://${{ env.ACRONYM }}-dev-pr-${{ github.event.number }}.apps.silver.devops.gov.bc.ca>