Skip to content

Commit

Permalink
Merge pull request #49 from bcgov/chore/remove-pr-deploy-openshift
Browse files Browse the repository at this point in the history
chore: remove openshift, deploy to github pages for PR pipeline
  • Loading branch information
mishraomp authored Oct 1, 2024
2 parents b1cbaf7 + 5d189b4 commit cf709aa
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 256 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/main-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,5 @@ jobs:
github_token: ${{ secrets.GITHUB_TOKEN }}
# Build output to publish to the `gh-pages` branch:
publish_dir: ./patterns/build
clean-exclude: pr-preview/
force: false
24 changes: 0 additions & 24 deletions .github/workflows/pr-close.yml

This file was deleted.

100 changes: 36 additions & 64 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -1,72 +1,44 @@
name: Deploy to OpenShift on PR
name: PR
on:
pull_request:
types:
- opened
- reopened
- synchronize
- closed
branches:
- main
workflow_dispatch:
concurrency: preview-${{ github.ref }}
permissions:
contents: write
pull-requests: write
jobs:
pr-description-add:
name: PR Description Add
runs-on: ubuntu-24.04
permissions:
pull-requests: write
timeout-minutes: 1
build-and-deploy:
runs-on: ubuntu-22.04
defaults:
run:
working-directory: ./patterns
steps:
- uses: bcgov-nr/[email protected]
- name: Checkout 🛎️
uses: actions/checkout@v4
- uses: actions/setup-node@v4
if: github.event.action != 'closed'
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-24.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/[email protected]
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-24.04
steps:
- uses: actions/checkout@v4
name: Checkout
- name: Deploy to OpenShift
shell: bash
node-version: 20
cache: npm
cache-dependency-path: patterns/package-lock.json

- name: Install dependencies
if: github.event.action != 'closed'
run: npm ci --ignore-scripts
- name: Install Dependencies and Build For PR🔧
if: github.event.action != 'closed'
env:
BASE_URL: /nr-architecture-patterns-library/pr-preview/pr-${{github.event.number}}
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 .
npm run build
- name: Deploy preview
uses: rossjrw/pr-preview-action@v1
with:
source-dir: ./patterns/build
32 changes: 0 additions & 32 deletions charts/nr-architecture-patterns-library/Chart.yaml

This file was deleted.

73 changes: 0 additions & 73 deletions charts/nr-architecture-patterns-library/values.yaml

This file was deleted.

40 changes: 0 additions & 40 deletions patterns/Caddyfile

This file was deleted.

23 changes: 0 additions & 23 deletions patterns/Dockerfile

This file was deleted.

0 comments on commit cf709aa

Please sign in to comment.