Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: remove openshift, deploy to github pages for PR pipeline #49

Merged
merged 1 commit into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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/action-pr-description-add@v1.1.2
- 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/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-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.