Skip to content

Commit

Permalink
Merge pull request #1 from luzmo-official/feat/add-ci-workflow
Browse files Browse the repository at this point in the history
Feat: Add a CI workflow
  • Loading branch information
KrijnL authored Aug 23, 2024
2 parents 2773d44 + 30e161b commit f116f43
Show file tree
Hide file tree
Showing 10 changed files with 92 additions and 7 deletions.
78 changes: 78 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: "Build and Deploy"
on:
push:
branches:
- main

pull_request:
types:
- opened
- synchronize

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
Build:
runs-on: ubuntu-latest
timeout-minutes: 15
strategy:
matrix:
include:
- name: dashboard-filter-panel
outputFolder: dist/dashboard-filter-panel/browser/
- name: drag-n-drop-chart-library
outputFolder: build/
- name: report-builder
outputFolder: dist/report-builder/browser/
- name: wearables-dashboard
outputFolder: dist/

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup node
uses: actions/setup-node@v3

- name: Cache node modules
uses: actions/cache@v2
with:
path: ${{ matrix.name }}/node_modules
key: ${{ runner.os }}-node-${{ matrix.name }}-${{ hashFiles(format('{0}/{1}', matrix.name, 'package-lock.json')) }}

- name: Build front end
run: |
cd ${{ matrix.name }}
npm ci
npm run build:ci
- name: Copy Folder
uses: keithweaver/[email protected]
if: github.event_name != 'pull_request'
with:
command: cp
source: ./${{ matrix.name }}/${{ matrix.outputFolder }}/
destination: s3://showcases.luzmo.com/${{ matrix.name }}/
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws_region: eu-west-1
flags: --recursive

Invalidate_Cloudfront:
runs-on: ubuntu-latest
timeout-minutes: 15
needs: Build
# if: github.event_name != 'pull_request'

steps:
- name: Invalidate CloudFront
uses: chetan/invalidate-cloudfront-action@v2
env:
DISTRIBUTION: ${{ secrets.CLOUDFRONT_DISTRIBUTION }}
PATHS: "/*"
AWS_REGION: "us-east-1"
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
.angular/
.nx/
node_modules/
**/dist/
2 changes: 1 addition & 1 deletion dashboard-filter-panel/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"build": {
"builder": "@angular/build:application",
"options": {
"outputPath": "dist/first-app",
"outputPath": "dist/dashboard-filter-panel",
"index": "src/index.html",
"browser": "src/main.ts",
"polyfills": ["zone.js"],
Expand Down
4 changes: 3 additions & 1 deletion dashboard-filter-panel/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"watch": "ng build --watch --configuration development"
"watch": "ng build --watch --configuration development",
"build:ci": "npx ng build --base-href /dashboard-filter-panel/"
},
"distDirectory": "dist/dashboard-filter-panel/browser/",
"private": true,
"dependencies": {
"@angular/animations": "^18.0.1",
Expand Down
2 changes: 1 addition & 1 deletion dashboard-filter-panel/src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Common</title>
<title>Dashboard Filter Panel</title>
<base href="/" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="icon" type="image/x-icon" href="favicon.ico" />
Expand Down
4 changes: 3 additions & 1 deletion drag-n-drop-chart-library/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,13 @@
"react-scripts": "5.0.1",
"web-vitals": "^2.1.4"
},
"homepage": "https://showcases.luzmo.com/drag-n-drop-chart-library",
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
"eject": "react-scripts eject",
"build:ci" : "CI=true npx react-scripts build"
},
"eslintConfig": {
"extends": [
Expand Down
2 changes: 1 addition & 1 deletion report-builder/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"build": {
"builder": "@angular/build:application",
"options": {
"outputPath": "dist/first-app",
"outputPath": "dist/report-builder",
"index": "src/index.html",
"browser": "src/main.ts",
"polyfills": ["zone.js"],
Expand Down
3 changes: 2 additions & 1 deletion report-builder/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"watch": "ng build --watch --configuration development"
"watch": "ng build --watch --configuration development",
"build:ci": "npx ng build --base-href=/report-builder/"
},
"private": true,
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion report-builder/src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Common</title>
<title>Report Builder</title>
<base href="/" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="icon" type="image/x-icon" href="favicon.ico" />
Expand Down
1 change: 1 addition & 0 deletions wearables-dashboard/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"start": "vite",
"dev": "vite",
"build": "tsc -b && vite build",
"build:ci": "vite build --base=/wearables-dashboard/",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview"
},
Expand Down

0 comments on commit f116f43

Please sign in to comment.