-
Notifications
You must be signed in to change notification settings - Fork 2
70 lines (65 loc) · 2.05 KB
/
pr-close.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
name: Cleanup
on:
pull_request:
types:
- closed
branches:
- main
- dev
env:
NAME: nrfc
jobs:
cleanup-openshift:
name: Cleanup OpenShift
runs-on: ubuntu-latest
environment:
name: dev
steps:
- uses: actions/checkout@v2
- name: Remove OpenShift artifacts
run: |
oc login --token=${{ secrets.OC_TOKEN }} --server=${{ secrets.OC_SERVER }}
oc project ${{ secrets.OC_NAMESPACE }}
# Remove old build runs, build pods and deployment pods
oc delete all,pvc,secret -l app=${{ env.NAME }}-${{ github.event.number }}
oc delete configmap ${{ env.NAME }}-${{ github.event.number }}-frontend
promote-images:
name: Promote DEV images to TEST
runs-on: ubuntu-latest
if: github.event.pull_request.merged == true
permissions:
contents: read
packages: write
steps:
- name: Promote Backend Image to TEST
uses: shrink/actions-docker-registry-tag@v2
with:
registry: ghcr.io
repository: ${{ github.repository }}
token: ${{ secrets.GITHUB_TOKEN }}
target: ${{ github.event.number }}-backend
tags: |
test-backend
- name: Promote Frontend Image to TEST
uses: shrink/actions-docker-registry-tag@v2
with:
registry: ghcr.io
repository: ${{ github.repository }}
token: ${{ secrets.GITHUB_TOKEN }}
target: ${{ github.event.number }}-frontend
tags: |
test-frontend
merge-notification:
name: Merge Notification
runs-on: ubuntu-latest
if: github.event.pull_request.merged == true
steps:
- name: Pre-merge update
uses: mshick/add-pr-comment@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
allow-repeats: false
message: |
Your Pull Request code is being promoted! Please follow the link below.
[Main Merge Workflow](https://github.com/${{ github.repository }}/actions/workflows/merge-main.yml)