forked from qld-gov-au/qgds-bootstrap5
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add CICD, remove binary folders which are auto cleaned and add them t…
…o gitignore folder, get eslint running with script, add mvn pom.xml wrapper for Java base Full Stack Devleopers
- Loading branch information
Showing
209 changed files
with
1,692 additions
and
63,154 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
|
||
TARGET_REPO secret must be set | ||
|
||
e.g. | ||
|
||
qld-gov-au/formio-qld | ||
|
||
GH_TOKEN secret must be set | ||
|
||
At this time this for repo qld-gov-au/formio it is set to a GHA token for @duttonw | ||
|
||
structure of the GH_TOKEN is | ||
|
||
${username}:${token} | ||
|
||
e.g. username:mypersonalaccesstoken | ||
|
||
if this fails, generate a new token via | ||
https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token | ||
and update the secret |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,164 @@ | ||
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node | ||
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions | ||
|
||
name: Build and Test | ||
|
||
on: | ||
push: | ||
pull_request: | ||
|
||
concurrency: | ||
group: compile-${{ github.workflow }}-${{ github.ref }} # Recommended if you intend to make multiple deployments in quick succession. | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
validate: | ||
|
||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
node: [ '20'] | ||
name: Lint test on Node ${{ matrix.node }} | ||
steps: | ||
- run: echo ${{github.ref}} | ||
|
||
- uses: actions/checkout@v4 | ||
|
||
- name: Use Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ matrix.node }} | ||
cache: 'npm' | ||
#always-auth: 'true' | ||
#registry-url: 'https://nexus.tools.services.qld.gov.au/nexus/repository/npm_all/' | ||
|
||
- name: npmrc #run on lint step (Which is cached) | ||
run: | | ||
npm -v | ||
node -v | ||
# cat /home/runner/work/_temp/.npmrc #only nice to test when registry is altered | ||
#env: | ||
# NODE_AUTH_TOKEN: ${{ secrets.NEXUSREADONLY2NPMTOKEN }} | ||
|
||
- name: Install | ||
run: | # Install packages | ||
npm install --prefer-offline --no-audit --ignore-scripts --force | ||
#env: | ||
# NODE_AUTH_TOKEN: ${{ secrets.NEXUSREADONLY2NPMTOKEN }} | ||
|
||
# `npm rebuild` will run all those post-install scripts for us. | ||
- name: rebuild and prepare | ||
run: npm rebuild && npm run prepare --if-present | ||
|
||
- name: Lint | ||
run: | | ||
npm run lint | ||
- name: Test | ||
run: | | ||
npm run test | ||
build: | ||
needs: validate | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
node: [ '20' ] | ||
name: Build and Deploy on Node ${{ matrix.node }} | ||
steps: | ||
- uses: actions/[email protected] | ||
|
||
- name: Cache node modules | ||
id: cache-npm | ||
uses: actions/cache@v3 | ||
env: | ||
cache-name: cache-node-modules | ||
with: | ||
# npm cache files are stored in `~/.npm` on Linux/macOS | ||
path: ~/.npm | ||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} | ||
restore-keys: | | ||
${{ runner.os }}-build-${{ env.cache-name }}- | ||
${{ runner.os }}-build- | ||
${{ runner.os }}- | ||
- if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }} | ||
name: List the state of node modules | ||
continue-on-error: true | ||
run: npm list | ||
|
||
- name: Use Node.js | ||
uses: actions/[email protected] | ||
with: | ||
node-version: ${{ matrix.node }} | ||
cache: 'npm' | ||
#always-auth: 'true' | ||
#registry-url: 'https://nexus.tools.services.qld.gov.au/nexus/repository/npm_all/' | ||
registry-url: 'https://registry.npmjs.org' | ||
- name: Install #run on lint step (Which is cached) | ||
run: | # Install packages | ||
npm install --prefer-offline --no-audit --ignore-scripts | ||
#env: | ||
# NODE_AUTH_TOKEN: ${{ secrets.NEXUSREADONLY2NPMTOKEN }} | ||
|
||
# `npm rebuild` will run all those post-install scripts for us. | ||
- name: rebuild and prepare | ||
run: npm rebuild && npm run prepare --if-present | ||
|
||
- name: Build 🔧 | ||
run: | # build the files | ||
npm run build | ||
# - name: Build storybook 🔧 | ||
# run: | # build the Storybook files | ||
# npm run build-storybook | ||
|
||
- name: setup Package | ||
run: | | ||
ls -ltr | ||
mkdir -p ./target/docs | ||
cp -r ./docs ./target/docs | ||
cp -r ./dist ./target/dist | ||
- uses: actions/[email protected] | ||
with: | ||
name: Package | ||
path: ./target | ||
|
||
|
||
- name: Extract branch name | ||
shell: bash | ||
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" | ||
id: extract_branch | ||
|
||
- name: display branch name | ||
shell: bash | ||
run: echo "${{ steps.extract_branch.outputs.branch }}" | ||
|
||
|
||
- name: setup Publish | ||
run: | | ||
set -x | ||
cp -r ./binary-repo/* ./dist | ||
- name: Publish qgds-qol-dist | ||
uses: qld-gov-au/gha-publish-to-git@master | ||
with: | ||
repository: ${{ secrets.TARGET_REPO }} | ||
git_ref: '${{ github.ref }}' | ||
branch: '${{ steps.extract_branch.outputs.branch }}' | ||
github_token: '${{ secrets.GH_TOKEN }}' | ||
github_pat: '${{ secrets.GH_PAT }}' | ||
source_folder: dist | ||
tag_branch: main | ||
if: success() | ||
|
||
- name: Publish to qgds-qol-cdn | ||
uses: qld-gov-au/gha-cdn-version-tree-by-tag-builder@main | ||
with: | ||
repository: 'qld-gov-au/formio-qld-cdn' | ||
git_ref: '${{ github.ref }}' | ||
branch: 'release' | ||
github_token: '${{ secrets.GH_TOKEN }}' | ||
github_pat: '${{ secrets.GH_PAT }}' | ||
source_folder: dist | ||
if: success() | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
name: Storybook deploy | ||
|
||
on: | ||
workflow_run: | ||
workflows: [Build and Test] # Reuse the name of your tests workflow | ||
branches: [main, develop] | ||
types: [completed ] | ||
|
||
concurrency: | ||
group: deploy-${{ github.workflow }}-${{ github.ref }} # Recommended if you intend to make multiple deployments in quick succession. | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
deploy: | ||
|
||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
node: [ '20' ] | ||
name: Deploy with Node ${{ matrix.node }} | ||
if: ${{ github.event.workflow_run.conclusion == 'success' }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Cache node modules | ||
id: cache-npm | ||
uses: actions/cache@v3 | ||
env: | ||
cache-name: cache-node-modules | ||
with: | ||
# npm cache files are stored in `~/.npm` on Linux/macOS | ||
path: ~/.npm | ||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} | ||
restore-keys: | | ||
${{ runner.os }}-build-${{ env.cache-name }}- | ||
${{ runner.os }}-build- | ||
${{ runner.os }}- | ||
- if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }} | ||
name: List the state of node modules | ||
continue-on-error: true | ||
run: npm list | ||
|
||
- name: Use Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ matrix.node }} | ||
cache: 'npm' | ||
#always-auth: 'true' | ||
#registry-url: 'https://nexus.tools.services.qld.gov.au/nexus/repository/npm_all/' | ||
registry-url: 'https://registry.npmjs.org' | ||
- name: Install | ||
run: | # Install packages | ||
npm install --prefer-offline --no-audit --ignore-scripts | ||
#env: | ||
# NODE_AUTH_TOKEN: ${{ secrets.NEXUSREADONLY2NPMTOKEN }} | ||
|
||
# `npm rebuild` will run all those post-install scripts for us. Without our secret key in ENV | ||
- name: rebuild and prepare | ||
run: npm rebuild && npm run prepare --if-present | ||
|
||
- name: Build 🔧 | ||
run: | # build the files | ||
npm run build | ||
- name: Build Storybook 🔧 | ||
run: | # build the Storybook files | ||
npm run build-storybook | ||
- uses: actions/upload-artifact@v4 #provide nice artifact | ||
with: | ||
name: Storybook | ||
path: storybook-static | ||
- name: Deploy 🚀 | ||
uses: JamesIves/github-pages-deploy-action@v4 | ||
with: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
BRANCH: gh-pages # The branch the action should deploy to. | ||
FOLDER: storybook-static # The folder that the build-storybook script generates files. | ||
CLEAN: true # Automatically remove deleted files from the deploy branch | ||
TARGET_FOLDER: docs # The folder that we serve our Storybook files from |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: Update Changelog | ||
on: | ||
release: | ||
types: [published] | ||
workflow_dispatch: | ||
inputs: | ||
description: | ||
description: 'Manual change log update' | ||
jobs: | ||
updateChangelog: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- name: Update Changelog | ||
# https://github.com/git-chglog/git-chglog#getting-started | ||
run: | | ||
mkdir tmp | ||
pushd tmp | ||
curl -o git-chglog.tar.gz -L https://github.com/git-chglog/git-chglog/releases/download/v0.15.1/git-chglog_0.15.1_linux_amd64.tar.gz | ||
#curl -o git-chglog.tar.gz -L https://github.com/git-chglog/git-chglog/releases/download/v0.15.1/git-chglog_0.15.1_darwin_amd64.tar.gz | ||
tar -zxvf git-chglog.tar.gz | ||
cp ./git-chglog ../git-chglog | ||
popd | ||
rm -rf tmp | ||
chmod u+x git-chglog | ||
./git-chglog -o CHANGELOG.md | ||
rm git-chglog | ||
- name: Create Pull Request | ||
uses: peter-evans/create-pull-request@v4 | ||
with: | ||
commit-message: update changelog | ||
title: Update Changelog | ||
body: Update changelog to reflect release changes | ||
branch: update-changelog | ||
base: main |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,8 @@ | ||
node | ||
node_modules | ||
.env | ||
.env | ||
.DS_Store | ||
.vscode | ||
storybook-static/ | ||
docs/ | ||
dist/ |
Oops, something went wrong.