Skip to content

Commit 58be9fb

Browse files
committed
Add CICD
* Remove binary folders which are auto cleaned and add them to gitignore folder * Get eslint running with script * Add mvn pom.xml wrapper for Java base Full Stack Devleopers * Make GH Pages deployment from storyboot-static via main/develop commit or via manual workflow request on branch
1 parent cdb7160 commit 58be9fb

File tree

210 files changed

+1733
-63154
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

210 files changed

+1733
-63154
lines changed

.eslintrc.cjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module.exports = {
33
"browser": true,
44
"es2021": true,
55
},
6-
"extends": ["eslint:recommended", "plugin:storybook/recommended"],
6+
"extends": ["eslint:recommended", "plugin:json/recommended", "plugin:storybook/recommended"],
77
"overrides": [
88
{
99
"env": {
@@ -15,7 +15,7 @@ module.exports = {
1515
"parserOptions": {
1616
"sourceType": "script",
1717
},
18-
},
18+
}
1919
],
2020
"parserOptions": {
2121
"ecmaVersion": "latest",

.github/workflows/README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
2+
TARGET_REPO secret must be set
3+
4+
e.g.
5+
6+
qld-gov-au/formio-qld
7+
8+
GH_TOKEN secret must be set
9+
10+
At this time this for repo qld-gov-au/formio it is set to a GHA token for @duttonw
11+
12+
structure of the GH_TOKEN is
13+
14+
${username}:${token}
15+
16+
e.g. username:mypersonalaccesstoken
17+
18+
if this fails, generate a new token via
19+
https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token
20+
and update the secret

.github/workflows/compile.js.yml

Lines changed: 191 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,191 @@
1+
# 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
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
3+
4+
name: Build and Test
5+
6+
on:
7+
push:
8+
pull_request:
9+
10+
concurrency:
11+
group: compile-${{ github.workflow }}-${{ github.ref }} # Recommended if you intend to make multiple deployments in quick succession.
12+
cancel-in-progress: true
13+
14+
jobs:
15+
validate:
16+
17+
runs-on: ubuntu-latest
18+
strategy:
19+
matrix:
20+
node: [ '20']
21+
name: Lint test on Node ${{ matrix.node }}
22+
steps:
23+
- run: echo ${{github.ref}}
24+
25+
- uses: actions/checkout@v4
26+
27+
- name: Use Node.js
28+
uses: actions/setup-node@v4
29+
with:
30+
node-version: ${{ matrix.node }}
31+
cache: 'npm'
32+
#always-auth: 'true'
33+
#registry-url: 'https://nexus.tools.services.qld.gov.au/nexus/repository/npm_all/'
34+
35+
- name: Cache node modules
36+
id: cache-npm
37+
uses: actions/cache@v3
38+
env:
39+
cache-name: cache-node-modules
40+
with:
41+
# npm cache files are stored in `~/.npm` on Linux/macOS
42+
path: ~/.npm
43+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
44+
restore-keys: |
45+
${{ runner.os }}-build-${{ env.cache-name }}-
46+
${{ runner.os }}-build-
47+
${{ runner.os }}-
48+
49+
- if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }}
50+
name: List the state of node modules
51+
continue-on-error: true
52+
run: npm list
53+
54+
- name: npmrc #run on lint step (Which is cached)
55+
run: |
56+
npm -v
57+
node -v
58+
# cat /home/runner/work/_temp/.npmrc #only nice to test when registry is altered
59+
#env:
60+
# NODE_AUTH_TOKEN: ${{ secrets.NEXUSREADONLY2NPMTOKEN }}
61+
62+
- name: Install
63+
run: | # Install packages
64+
npm install --prefer-offline --no-audit --ignore-scripts --force
65+
#env:
66+
# NODE_AUTH_TOKEN: ${{ secrets.NEXUSREADONLY2NPMTOKEN }}
67+
68+
# `npm rebuild` will run all those post-install scripts for us.
69+
- name: rebuild and prepare
70+
run: npm rebuild && npm run prepare --if-present
71+
72+
- name: Lint
73+
run: |
74+
npm run lint
75+
- name: Test
76+
run: |
77+
npm run test
78+
79+
build:
80+
needs: validate
81+
runs-on: ubuntu-latest
82+
strategy:
83+
matrix:
84+
node: [ '20' ]
85+
name: Build and Deploy on Node ${{ matrix.node }}
86+
steps:
87+
- uses: actions/checkout@v4.1.2
88+
89+
- name: Cache node modules
90+
id: cache-npm
91+
uses: actions/cache@v3
92+
env:
93+
cache-name: cache-node-modules
94+
with:
95+
# npm cache files are stored in `~/.npm` on Linux/macOS
96+
path: ~/.npm
97+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
98+
restore-keys: |
99+
${{ runner.os }}-build-${{ env.cache-name }}-
100+
${{ runner.os }}-build-
101+
${{ runner.os }}-
102+
103+
- if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }}
104+
name: List the state of node modules
105+
continue-on-error: true
106+
run: npm list
107+
108+
- name: Use Node.js
109+
uses: actions/setup-node@v4.0.2
110+
with:
111+
node-version: ${{ matrix.node }}
112+
cache: 'npm'
113+
#always-auth: 'true'
114+
#registry-url: 'https://nexus.tools.services.qld.gov.au/nexus/repository/npm_all/'
115+
registry-url: 'https://registry.npmjs.org'
116+
- name: Install #run on lint step (Which is cached)
117+
run: | # Install packages
118+
npm install --prefer-offline --no-audit --ignore-scripts
119+
#env:
120+
# NODE_AUTH_TOKEN: ${{ secrets.NEXUSREADONLY2NPMTOKEN }}
121+
122+
# `npm rebuild` will run all those post-install scripts for us.
123+
- name: rebuild and prepare
124+
run: npm rebuild && npm run prepare --if-present
125+
126+
- name: Build 🔧
127+
run: | # build the files
128+
npm run build
129+
# - name: Build storybook 🔧
130+
# run: | # build the Storybook files
131+
# npm run build-storybook
132+
133+
- name: setup Package
134+
run: |
135+
ls -ltr
136+
mkdir -p ./target/docs
137+
cp -r ./docs ./target/docs
138+
cp -r ./dist ./target/dist
139+
140+
- uses: actions/upload-artifact@v4.3.1
141+
with:
142+
name: Package
143+
path: ./target
144+
145+
146+
- name: Extract branch name
147+
shell: bash
148+
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
149+
id: extract_branch
150+
151+
- name: display branch name
152+
shell: bash
153+
run: echo "${{ steps.extract_branch.outputs.branch }}"
154+
155+
156+
- name: setup Publish
157+
run: |
158+
set -x
159+
cp -r ./binary-repo/* ./dist
160+
161+
- name: Publish qgds-qol-dist
162+
uses: qld-gov-au/gha-publish-to-git@master
163+
with:
164+
repository: ${{ secrets.TARGET_REPO }}
165+
git_ref: '${{ github.ref }}'
166+
branch: '${{ steps.extract_branch.outputs.branch }}'
167+
github_token: '${{ secrets.GH_TOKEN }}'
168+
github_pat: '${{ secrets.GH_PAT }}'
169+
source_folder: dist
170+
tag_branch: main
171+
if: success()
172+
173+
- name: Publish to qgds-qol-cdn
174+
uses: qld-gov-au/gha-cdn-version-tree-by-tag-builder@main
175+
with:
176+
repository: 'qld-gov-au/formio-qld-cdn'
177+
git_ref: '${{ github.ref }}'
178+
branch: 'release'
179+
github_token: '${{ secrets.GH_TOKEN }}'
180+
github_pat: '${{ secrets.GH_PAT }}'
181+
source_folder: dist
182+
if: success()
183+
184+
- name: Build Storybook 🔧
185+
run: | # build the Storybook files
186+
npm run build-storybook
187+
- name: Package storybook files
188+
uses: actions/upload-artifact@v4 #provide nice artifact
189+
with:
190+
name: Storybook
191+
path: storybook-static
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
name: Storybook deploy
2+
3+
on:
4+
# Allows you to run this workflow manually from the Actions tab
5+
workflow_dispatch:
6+
workflow_run:
7+
workflows: [Build and Test] # Reuse the name of your tests workflow
8+
branches: [main, develop]
9+
types: [completed ]
10+
11+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
12+
permissions:
13+
contents: read
14+
pages: write
15+
actions: read
16+
id-token: write
17+
18+
concurrency:
19+
group: deploy-${{ github.workflow }}-${{ github.ref }} # Recommended if you intend to make multiple deployments in quick succession.
20+
cancel-in-progress: false
21+
22+
jobs:
23+
deploy:
24+
environment:
25+
name: github-pages
26+
url: ${{ steps.deployment.outputs.page_url }}
27+
runs-on: ubuntu-latest
28+
strategy:
29+
matrix:
30+
node: [ '20' ]
31+
name: Deploy with Node ${{ matrix.node }}
32+
if: ${{ github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success' }}
33+
steps:
34+
- uses: actions/checkout@v4
35+
36+
- name: Cache node modules
37+
id: cache-npm
38+
uses: actions/cache@v3
39+
env:
40+
cache-name: cache-node-modules
41+
with:
42+
# npm cache files are stored in `~/.npm` on Linux/macOS
43+
path: ~/.npm
44+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
45+
restore-keys: |
46+
${{ runner.os }}-build-${{ env.cache-name }}-
47+
${{ runner.os }}-build-
48+
${{ runner.os }}-
49+
50+
- if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }}
51+
name: List the state of node modules
52+
continue-on-error: true
53+
run: npm list
54+
55+
- name: Use Node.js
56+
uses: actions/setup-node@v4
57+
with:
58+
node-version: ${{ matrix.node }}
59+
cache: 'npm'
60+
#always-auth: 'true'
61+
#registry-url: 'https://nexus.tools.services.qld.gov.au/nexus/repository/npm_all/'
62+
registry-url: 'https://registry.npmjs.org'
63+
- name: Install
64+
run: | # Install packages
65+
npm install --prefer-offline --no-audit --ignore-scripts
66+
#env:
67+
# NODE_AUTH_TOKEN: ${{ secrets.NEXUSREADONLY2NPMTOKEN }}
68+
69+
# `npm rebuild` will run all those post-install scripts for us. Without our secret key in ENV
70+
- name: rebuild and prepare
71+
run: npm rebuild && npm run prepare --if-present
72+
73+
- name: Build 🔧
74+
run: | # build the files
75+
npm run build
76+
- name: Build Storybook 🔧
77+
run: | # build the Storybook files
78+
npm run build-storybook
79+
- uses: actions/upload-artifact@v4 #provide nice artifact
80+
with:
81+
name: Storybook
82+
path: storybook-static
83+
84+
- name: Setup Pages
85+
uses: actions/configure-pages@v4
86+
- name: Upload artifact
87+
uses: actions/upload-pages-artifact@v3
88+
with:
89+
path: "./storybook-static"
90+
- name: Deploy to GitHub Pages
91+
id: deployment
92+
uses: actions/deploy-pages@v4.0.5

.github/workflows/updateChangeLog.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Update Changelog
2+
on:
3+
release:
4+
types: [published]
5+
workflow_dispatch:
6+
inputs:
7+
description:
8+
description: 'Manual change log update'
9+
jobs:
10+
updateChangelog:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v3
14+
with:
15+
fetch-depth: 0
16+
- name: Update Changelog
17+
# https://github.com/git-chglog/git-chglog#getting-started
18+
run: |
19+
mkdir tmp
20+
pushd tmp
21+
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
22+
#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
23+
tar -zxvf git-chglog.tar.gz
24+
cp ./git-chglog ../git-chglog
25+
popd
26+
rm -rf tmp
27+
chmod u+x git-chglog
28+
./git-chglog -o CHANGELOG.md
29+
rm git-chglog
30+
- name: Create Pull Request
31+
uses: peter-evans/create-pull-request@v4
32+
with:
33+
commit-message: update changelog
34+
title: Update Changelog
35+
body: Update changelog to reflect release changes
36+
branch: update-changelog
37+
base: main

.gitignore

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,8 @@
1+
node
12
node_modules
2-
.env
3+
.env
4+
.DS_Store
5+
.vscode
6+
storybook-static/
7+
docs/
8+
dist/

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
registry=https://registry.npmjs.org

0 commit comments

Comments
 (0)