Skip to content

Commit

Permalink
Feat: refactor release script
Browse files Browse the repository at this point in the history
  • Loading branch information
mbarbet committed Jan 28, 2025
1 parent 54738e8 commit fbba1e1
Show file tree
Hide file tree
Showing 18 changed files with 94 additions and 397 deletions.
22 changes: 15 additions & 7 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,27 @@ jobs:
run: npm run license-check
- name: Test
run: npm run test
- name: Build
- name: Build lib
run: |
export NODE_OPTIONS=--max_old_space_size=8192;
npm install
npm install --workspaces=false
npm run build-lib
- name: Build cloud
run: |
export NODE_OPTIONS=--max_old_space_size=8192;
npm install --workspace=packages/cloud --include-workspace-root=true
npm rebuild node-sass
npm run build-opensource
npm run build-cloud
npm run build-opensource-lib
npm run build-cloud-lib
- name: Build open source
run: |
export NODE_OPTIONS=--max_old_space_size=8192;
npm install --workspace=packages/opensource --include-workspace-root=true
npm rebuild node-sass
npm run build-opensource
- name: Docker build
run: |
export NODE_OPTIONS=--max_old_space_size=8192;
docker build -f docker/Dockerfile-production-cloud .;
docker build -f docker/Dockerfile-production-opensource .
docker build -f docker/Dockerfile --build-arg WORKSPACE=cloud .;
docker build -f docker/Dockerfile --build-arg WORKSPACE=opensource .
#- name: i18n
# run: ./checki18n.sh
4 changes: 2 additions & 2 deletions .github/workflows/trivy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ jobs:

- name: Build -opensource and cloud- Docker images
run: |
docker build -f docker/Dockerfile-production-cloud -t docker.io/gisaia/arlas-wui-cloud:${{ github.sha }} .
docker build -f docker/Dockerfile-production-opensource -t docker.io/gisaia/arlas-wui:${{ github.sha }} .
docker build -f docker/Dockerfile --build-arg WORKSPACE=cloud -t docker.io/gisaia/arlas-wui-cloud:${{ github.sha }} .
docker build -f docker/Dockerfile --build-arg WORKSPACE=opensource -t docker.io/gisaia/arlas-wui:${{ github.sha }} .
- name: Run Trivy vulnerability scanner on opensource image
uses: aquasecurity/trivy-action@master
env:
Expand Down
23 changes: 3 additions & 20 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@
}
}
},
"arlas-wui-opensource-lib": {
"arlas-wui-lib": {
"projectType": "library",
"root": "",
"sourceRoot": "src",
Expand All @@ -318,25 +318,8 @@
"defaultConfiguration": "production-opensource",
"configurations": {
"production-opensource": {
"tsConfig": "tsconfig.lib.prod.opensource.json",
"project": "ng-package.opensource.json"
}
}
}
}
},
"arlas-wui-cloud-lib": {
"projectType": "library",
"root": "",
"sourceRoot": "src",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:ng-packagr",
"defaultConfiguration": "production-cloud",
"configurations": {
"production-cloud": {
"tsConfig": "tsconfig.lib.prod.cloud.json",
"project": "ng-package.cloud.json"
"tsConfig": "tsconfig.lib.prod.json",
"project": "ng-package.json"
}
}
}
Expand Down
23 changes: 9 additions & 14 deletions docker/Dockerfile-production-cloud → docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,24 +1,19 @@

### STAGE 1: Build ###

# We label our stage as 'builder'
FROM node:18.20.5 AS builder
ARG WORKSPACE

COPY ./packages/cloud/package-docker.json ./package.json

RUN npm set progress=false && npm config set depth 0 && npm cache clean --force

## Storing node modules on a separate layer will prevent unnecessary npm installs at each build
RUN npm i && mkdir /ng-app && cp -R ./node_modules ./ng-app

COPY ./scripts/start.sh ./ng-app
COPY ./scripts/fetch-conf-by-http.sh ./ng-app

RUN mkdir /ng-app
WORKDIR /ng-app

COPY . .

## Build the angular app in production mode and store the artifacts in <dist folder>
RUN npm run build-cloud
RUN rm -rf node_modules
RUN npm install --workspace=packages/$WORKSPACE --include-workspace-root=true
COPY ./scripts/start.sh .
COPY ./scripts/fetch-conf-by-http.sh .
## Build the angular app in production mode and store the artifacts in dist folder
RUN npm run build-$WORKSPACE

### STAGE 2: Setup ###

Expand Down
Empty file.
47 changes: 0 additions & 47 deletions docker/Dockerfile-production-opensource

This file was deleted.

15 changes: 0 additions & 15 deletions ng-package.cloud.json

This file was deleted.

2 changes: 1 addition & 1 deletion ng-package.opensource.json → ng-package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
"."
],
"lib": {
"entryFile": "src/public-api.opensource.ts"
"entryFile": "src/public-api.ts"
}
}
57 changes: 14 additions & 43 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 6 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
{
"name": "arlas-wui",
"workspaces": [
"packages/cloud",
"packages/opensource"
],
"version": "27.1.0-dev",
"author": "gisaia",
"license": "Apache-2.0",
Expand All @@ -10,10 +14,9 @@
"start": "ng serve",
"build-opensource-stats": "ng build arlas-wui --configuration production-opensource --aot --base-href='$ARLAS_WUI_BASE_HREF/' --stats-json --metafile=meta.json",
"build-opensource": "ng build arlas-wui --configuration production-opensource --aot --base-href='$ARLAS_WUI_BASE_HREF/'",
"build-opensource-lib": "ng build arlas-wui-opensource-lib",
"build-lib": "ng build arlas-wui-lib",
"analyze-opensource": "esbuild-visualizer --metadata dist/stats.json",
"build-cloud": "ng build arlas-wui --configuration production-cloud --aot --base-href='$ARLAS_WUI_BASE_HREF/'",
"build-cloud-lib": "ng build arlas-wui-cloud-lib",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e",
Expand Down Expand Up @@ -75,9 +78,5 @@
"ts-node": "~10.4.0",
"typescript": "5.5.4",
"webpack-bundle-analyzer": "^4.10.2"
},
"workspaces": [
"packages/cloud",
"packages/opensource"
]
}
}
Loading

0 comments on commit fbba1e1

Please sign in to comment.