Pipeline updates #148
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Pull Request Closed | |
on: | |
pull_request: | |
types: | |
- closed | |
paths-ignore: | |
- ".github/ISSUE_TEMPLATE/*" | |
- "**.md" | |
env: | |
name: nr-ticdi | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
# Clean up OpenShift when PR closed, no conditions | |
cleanup-openshift: | |
name: Cleanup OpenShift | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- 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 -l app=${{ env.name }}-${{ github.event.number }} | |
# If merged into main, then handle any image promotions | |
image-promotions: | |
name: Image Promotions | |
if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'main' | |
uses: ./.github/workflows/_image_promote.yml | |
strategy: | |
matrix: | |
component: [backend, frontend] | |
with: | |
app_name: nr-ticdi | |
component: ${{ matrix.component }} | |
env_source: ${{ github.event.number }} | |
env_target: test | |
secrets: | |
oc_namespace: ${{ secrets.OC_NAMESPACE }} | |
oc_server: ${{ secrets.OC_SERVER }} | |
oc_token: ${{ secrets.OC_TOKEN }} | |
# Notify when PR merged into main | |
merge-notification: | |
name: Merge Notification | |
runs-on: ubuntu-22.04 | |
if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'main' | |
steps: | |
- name: Pre-merge update | |
uses: mshick/add-pr-comment@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GHCR_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) |