From ffa8c621f9c4d382fb039789aef2d484b9325fcb Mon Sep 17 00:00:00 2001 From: jojozhuang Date: Sat, 8 Nov 2025 08:51:49 -0800 Subject: [PATCH 1/5] Fix the deployment to text-compare2 on azure --- .github/workflows/main_text-compare2.yml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/main_text-compare2.yml b/.github/workflows/main_text-compare2.yml index 9a02a7b5..967e9374 100644 --- a/.github/workflows/main_text-compare2.yml +++ b/.github/workflows/main_text-compare2.yml @@ -26,25 +26,25 @@ jobs: - name: npm install, build, and test run: | npm install - npm run build --if-present - npm run test --if-present + npm run build + npm run test:headless - name: Upload artifact for deployment job uses: actions/upload-artifact@v4 with: name: node-app - path: . + path: ./dist/browser deploy: runs-on: ubuntu-latest needs: build - + steps: - name: Download artifact from build job uses: actions/download-artifact@v4 with: name: node-app - + - name: 'Deploy to Azure Web App' id: deploy-to-webapp uses: azure/webapps-deploy@v3 @@ -52,4 +52,5 @@ jobs: app-name: 'text-compare2' slot-name: 'Production' package: . - publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_23137CCA3349499E9B3DCC0705F4C348 }} \ No newline at end of file + publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_23137CCA3349499E9B3DCC0705F4C348 }} + clean: true \ No newline at end of file From a874d2971228a8a360500a30c2c0553803247084 Mon Sep 17 00:00:00 2001 From: jojozhuang Date: Sat, 8 Nov 2025 08:52:26 -0800 Subject: [PATCH 2/5] trigger the build --- .github/workflows/main_text-compare2.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main_text-compare2.yml b/.github/workflows/main_text-compare2.yml index 967e9374..483e1cef 100644 --- a/.github/workflows/main_text-compare2.yml +++ b/.github/workflows/main_text-compare2.yml @@ -6,7 +6,7 @@ name: Build and deploy Node.js app to Azure Web App - text-compare2 on: push: branches: - - main + - fix-deployment-to-text-compare2 workflow_dispatch: jobs: From 0d9cbcff06a06d0ca32f593a21bd8d49e26a0e69 Mon Sep 17 00:00:00 2001 From: jojozhuang Date: Sat, 8 Nov 2025 09:19:21 -0800 Subject: [PATCH 3/5] add deployment config for azure --- .github/workflows/main_text-compare2.yml | 2 +- angular.json | 22 ++++++++++++++++++++++ package.json | 1 + src/environments/environment.azure.ts | 4 ++++ 4 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 src/environments/environment.azure.ts diff --git a/.github/workflows/main_text-compare2.yml b/.github/workflows/main_text-compare2.yml index 483e1cef..f93e342f 100644 --- a/.github/workflows/main_text-compare2.yml +++ b/.github/workflows/main_text-compare2.yml @@ -26,7 +26,7 @@ jobs: - name: npm install, build, and test run: | npm install - npm run build + npm run build:azure npm run test:headless - name: Upload artifact for deployment job diff --git a/angular.json b/angular.json index 2a278992..857e53b7 100644 --- a/angular.json +++ b/angular.json @@ -42,6 +42,25 @@ "browser": "src/main.ts" }, "configurations": { + "azure": { + "budgets": [ + { + "type": "anyComponentStyle", + "maximumWarning": "6kb" + } + ], + "optimization": true, + "outputHashing": "all", + "sourceMap": false, + "namedChunks": false, + "extractLicenses": true, + "fileReplacements": [ + { + "replace": "src/environments/environment.ts", + "with": "src/environments/environment.azure.ts" + } + ] + }, "nas": { "budgets": [ { @@ -90,6 +109,9 @@ "buildTarget": "text-compare-angular:build" }, "configurations": { + "azure": { + "buildTarget": "text-compare-angular:build:azure" + }, "nas": { "buildTarget": "text-compare-angular:build:nas" }, diff --git a/package.json b/package.json index a41a5543..adfa917a 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,7 @@ "start:nas": "ng serve --configuration nas", "start:mock": "node server.js", "build": "ng build --configuration production", + "build:azure": "ng build --configuration azure", "build:nas": "ng build --configuration nas", "build:cross:env": "rimraf dist compiled && cross-env SOURCE_MAP=0 ng build --configuration production", "test": "ng test", diff --git a/src/environments/environment.azure.ts b/src/environments/environment.azure.ts new file mode 100644 index 00000000..de4d7e27 --- /dev/null +++ b/src/environments/environment.azure.ts @@ -0,0 +1,4 @@ +export const environment = { + production: true, + env_name: 'Azure' +}; From f93b679730c44cf61dce677aed659d85845557ed Mon Sep 17 00:00:00 2001 From: jojozhuang Date: Sat, 8 Nov 2025 09:41:27 -0800 Subject: [PATCH 4/5] add deployment script for netlify and render --- angular.json | 44 +++++++++++++++++++++++++ package.json | 2 ++ src/environments/environment.netlify.ts | 4 +++ src/environments/environment.render.ts | 4 +++ 4 files changed, 54 insertions(+) create mode 100644 src/environments/environment.netlify.ts create mode 100644 src/environments/environment.render.ts diff --git a/angular.json b/angular.json index 857e53b7..e5f63921 100644 --- a/angular.json +++ b/angular.json @@ -61,6 +61,44 @@ } ] }, + "netlify": { + "budgets": [ + { + "type": "anyComponentStyle", + "maximumWarning": "6kb" + } + ], + "optimization": true, + "outputHashing": "all", + "sourceMap": false, + "namedChunks": false, + "extractLicenses": true, + "fileReplacements": [ + { + "replace": "src/environments/environment.ts", + "with": "src/environments/environment.netlify.ts" + } + ] + }, + "render": { + "budgets": [ + { + "type": "anyComponentStyle", + "maximumWarning": "6kb" + } + ], + "optimization": true, + "outputHashing": "all", + "sourceMap": false, + "namedChunks": false, + "extractLicenses": true, + "fileReplacements": [ + { + "replace": "src/environments/environment.ts", + "with": "src/environments/environment.render.ts" + } + ] + }, "nas": { "budgets": [ { @@ -112,6 +150,12 @@ "azure": { "buildTarget": "text-compare-angular:build:azure" }, + "netlify": { + "buildTarget": "text-compare-angular:build:netlify" + }, + "render": { + "buildTarget": "text-compare-angular:build:render" + }, "nas": { "buildTarget": "text-compare-angular:build:nas" }, diff --git a/package.json b/package.json index adfa917a..26cf8b74 100644 --- a/package.json +++ b/package.json @@ -13,6 +13,8 @@ "start:mock": "node server.js", "build": "ng build --configuration production", "build:azure": "ng build --configuration azure", + "build:netlify": "ng build --configuration netlify", + "build:render": "ng build --configuration render", "build:nas": "ng build --configuration nas", "build:cross:env": "rimraf dist compiled && cross-env SOURCE_MAP=0 ng build --configuration production", "test": "ng test", diff --git a/src/environments/environment.netlify.ts b/src/environments/environment.netlify.ts new file mode 100644 index 00000000..b2d5a06f --- /dev/null +++ b/src/environments/environment.netlify.ts @@ -0,0 +1,4 @@ +export const environment = { + production: true, + env_name: 'Netlify' +}; diff --git a/src/environments/environment.render.ts b/src/environments/environment.render.ts new file mode 100644 index 00000000..894616e5 --- /dev/null +++ b/src/environments/environment.render.ts @@ -0,0 +1,4 @@ +export const environment = { + production: true, + env_name: 'Render' +}; From 5c914a4081fbb387aef6712f40adab1f6285e52e Mon Sep 17 00:00:00 2001 From: jojozhuang Date: Sat, 8 Nov 2025 09:46:52 -0800 Subject: [PATCH 5/5] revert to main --- .github/workflows/main_text-compare2.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main_text-compare2.yml b/.github/workflows/main_text-compare2.yml index f93e342f..45544b6b 100644 --- a/.github/workflows/main_text-compare2.yml +++ b/.github/workflows/main_text-compare2.yml @@ -6,7 +6,7 @@ name: Build and deploy Node.js app to Azure Web App - text-compare2 on: push: branches: - - fix-deployment-to-text-compare2 + - main workflow_dispatch: jobs: