From d82bf5a8a3791b53dc820774b882378fd3bfa6ca Mon Sep 17 00:00:00 2001 From: Jeremy Ho Date: Wed, 23 Oct 2024 10:53:00 -0700 Subject: [PATCH 1/2] Update github actions with updated patterns for Docusaurus building Signed-off-by: Jeremy Ho --- .github/workflows/main-merge.yml | 73 ++++++++++++++++++-------------- .github/workflows/pr.yml | 45 ++++++++++++-------- 2 files changed, 69 insertions(+), 49 deletions(-) diff --git a/.github/workflows/main-merge.yml b/.github/workflows/main-merge.yml index aa7db6a..3dbbb4b 100644 --- a/.github/workflows/main-merge.yml +++ b/.github/workflows/main-merge.yml @@ -1,38 +1,47 @@ -name: Deploy to GitHub Pages on push to main +name: Deploy Main to GitHub Pages + on: push: branches: - main -jobs: - build-deploy: - name: Build and Deploy Docusaurus to GitHub Pages - runs-on: ubuntu-24.04 - defaults: - run: - working-directory: ./patterns - - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - with: - node-version: 20 - cache: npm - cache-dependency-path: patterns/package-lock.json - - - name: Install dependencies - run: npm ci --ignore-scripts - - name: Build website - run: | - export BASE_URL="/nr-architecture-patterns-library" && npm run build +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true - # Popular action to deploy to GitHub Pages: - # Docs: https://github.com/peaceiris/actions-gh-pages#%EF%B8%8F-docusaurus - - name: Deploy to GitHub Pages - uses: peaceiris/actions-gh-pages@v4 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - # Build output to publish to the `gh-pages` branch: - publish_dir: ./patterns/build - clean-exclude: pr-preview/ - force: false +jobs: + build-deploy: + name: Build and Deploy Docusaurus to GitHub Pages + runs-on: ubuntu-24.04 + timeout-minutes: 10 + permissions: + contents: write + pull-requests: write + defaults: + run: + working-directory: ./patterns + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Use Node + uses: actions/setup-node@v4 + with: + node-version: 20 + cache: npm + cache-dependency-path: patterns/package-lock.json + - name: Install dependencies + run: npm ci --ignore-scripts + - name: Build website + env: + BASE_URL: /nr-architecture-patterns-library + run: npm run build + - name: Deploy to GitHub Pages + uses: JamesIves/github-pages-deploy-action@v4 + with: + folder: patterns/build + branch: gh-pages + clean-exclude: pr-preview/ + single-commit: true # Drop unnecessary commit history from gh-pages + force: true # Set to false if we start losing PR deployment previews diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index b1b1648..f91ad82 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -1,44 +1,55 @@ -name: PR +name: Deploy PR to Github Pages + on: pull_request: + branches: + - main types: - opened - reopened - synchronize - closed - branches: - - main workflow_dispatch: -concurrency: preview-${{ github.ref }} -permissions: - contents: write - pull-requests: write + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + jobs: - build-and-deploy: + build-deploy: + name: Build and Deploy to GitHub Pages runs-on: ubuntu-24.04 + timeout-minutes: 10 + permissions: + contents: write + pull-requests: write defaults: run: working-directory: ./patterns steps: - name: Checkout 🛎️ uses: actions/checkout@v4 - - uses: actions/setup-node@v4 + with: + fetch-depth: 0 + - name: Use Node + uses: actions/setup-node@v4 if: github.event.action != 'closed' with: 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🔧 + run: npm ci --ignore-scripts + - name: Build website if: github.event.action != 'closed' env: - BASE_URL: /nr-architecture-patterns-library/pr-preview/pr-${{github.event.number}} - run: | - npm run build - - name: Deploy preview + BASE_URL: /nr-architecture-patterns-library/pr-preview/pr-${{ github.event.pull_request.number }} + run: npm run build + - name: Deploy to/Cleanup GitHub Pages uses: rossjrw/pr-preview-action@v1 with: - source-dir: ./patterns/build \ No newline at end of file + source-dir: ./patterns/build + preview-branch: gh-pages + umbrella-dir: pr-preview + action: auto From 76b7a4074fdd0740125ed86a9d966b3be9029d46 Mon Sep 17 00:00:00 2001 From: Jeremy Ho Date: Wed, 23 Oct 2024 10:57:03 -0700 Subject: [PATCH 2/2] Minor repository housekeeping and documentation Signed-off-by: Jeremy Ho --- .gitattributes | 8 ++++++++ CONTRIBUTING.md | 12 +++++++++++- LICENSE | 2 +- README.md | 6 ++++-- 4 files changed, 24 insertions(+), 4 deletions(-) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..fd57b60 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,8 @@ +# Autodetect text files and forces unix eols, so Windows does not break them +* text=auto eol=lf + +# Force images/fonts to be handled as binaries +*.jpg binary +*.jpeg binary +*.gif binary +*.png binary diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 55fded0..aa03a19 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,4 +1,14 @@ # How to contribute -### Not the below will update as we do some initial iterations. + +Government employees, public and members of the private sector are encouraged to contribute to the repository by **forking and submitting a pull request**. + +(If you are new to GitHub, you might start with a [basic tutorial](https://help.github.com/articles/set-up-git) and check out a more detailed guide to [pull requests](https://help.github.com/articles/using-pull-requests/).) + +Pull requests will be evaluated by the repository guardians on a schedule and if deemed beneficial will be committed to the master. + +All contributors retain the original copyright to their stuff, but by contributing to this project, you grant a world-wide, royalty-free, perpetual, irrevocable, non-exclusive, transferable license to all users **under the terms of the [license](./LICENSE) under which this project is distributed**. + +## Note the below will update as we do some initial iterations + If you are in a developer or architect role and have experience in event-driven architecture, please create a pull request to update specific content or add new content. Please make sure to provide proper links and implementation details for review. diff --git a/LICENSE b/LICENSE index 261eeb9..86bb2f6 100644 --- a/LICENSE +++ b/LICENSE @@ -186,7 +186,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright [yyyy] [name of copyright owner] + Copyright 2024 Province of British Columbia Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/README.md b/README.md index ae801b2..6be489a 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,4 @@ -# nr-architecture-patterns-library -This repository contains the patterns library from NRM architecture team in confluence space. This is a public view of those library and guidance. +# NR Architecture Patterns Library + +This repository contains the patterns library from NRM architecture team in +confluence space. This is a public view of those library and guidance.