From 38fe4d8900c1fc354eb57b3823364144e2124e9f Mon Sep 17 00:00:00 2001 From: chrisdca Date: Tue, 30 Sep 2025 14:34:10 -0500 Subject: [PATCH 1/9] feat: add azure web app --- .github/workflows/workflow-azure-web-app.yml | 26 ++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 .github/workflows/workflow-azure-web-app.yml diff --git a/.github/workflows/workflow-azure-web-app.yml b/.github/workflows/workflow-azure-web-app.yml new file mode 100644 index 0000000..1490817 --- /dev/null +++ b/.github/workflows/workflow-azure-web-app.yml @@ -0,0 +1,26 @@ +name: Build and deploy Node.js app to Azure Web App +on: push + +jobs: + build-and-deploy: + runs-on: ubuntu-latest + steps: + - name: "Checkout Github Action" + uses: actions/checkout@v4 + + - name: Setup Node 22.x + uses: actions/setup-node@v4 + with: + node-version: "22.x" + + - name: "npm install, build, and test" + run: | + npm install + npm run build --if-present + npm run test --if-present + + - name: "Run Azure webapp deploy action using publish profile credentials" + uses: azure/webapps-deploy@v2.2.17 + with: + app-name: web-with-nextjs + publish-profile: ${{ secrets.AZURE_WEB_APP_PUBLISH_PROFILE }} From f53e5f75539243e70228ead4b222d20870ad6c01 Mon Sep 17 00:00:00 2001 From: chrisdca Date: Tue, 30 Sep 2025 16:04:14 -0500 Subject: [PATCH 2/9] feat: update CI --- .github/workflows/workflow-azure-web-app.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/workflow-azure-web-app.yml b/.github/workflows/workflow-azure-web-app.yml index 1490817..add2f95 100644 --- a/.github/workflows/workflow-azure-web-app.yml +++ b/.github/workflows/workflow-azure-web-app.yml @@ -12,12 +12,15 @@ jobs: uses: actions/setup-node@v4 with: node-version: "22.x" + cache: "npm" - - name: "npm install, build, and test" + - name: Build Next.js app + run: npm run build + + - name: Install production dependencies only run: | - npm install - npm run build --if-present - npm run test --if-present + rm -rf node_modules + npm ci --only=production - name: "Run Azure webapp deploy action using publish profile credentials" uses: azure/webapps-deploy@v2.2.17 From 5b0bd5b52e2f0e4faee333019836cfd6aae30a79 Mon Sep 17 00:00:00 2001 From: chrisdca Date: Tue, 30 Sep 2025 16:06:21 -0500 Subject: [PATCH 3/9] feat: delete cache --- .github/workflows/workflow-azure-web-app.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/workflow-azure-web-app.yml b/.github/workflows/workflow-azure-web-app.yml index add2f95..a967b8f 100644 --- a/.github/workflows/workflow-azure-web-app.yml +++ b/.github/workflows/workflow-azure-web-app.yml @@ -12,7 +12,6 @@ jobs: uses: actions/setup-node@v4 with: node-version: "22.x" - cache: "npm" - name: Build Next.js app run: npm run build From 56ff2d073a3a35929240d50f23eeee6a503b0c92 Mon Sep 17 00:00:00 2001 From: chrisdca Date: Tue, 30 Sep 2025 16:08:15 -0500 Subject: [PATCH 4/9] feat: add arguments --- .github/workflows/workflow-azure-web-app.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/workflow-azure-web-app.yml b/.github/workflows/workflow-azure-web-app.yml index a967b8f..134b610 100644 --- a/.github/workflows/workflow-azure-web-app.yml +++ b/.github/workflows/workflow-azure-web-app.yml @@ -12,9 +12,10 @@ jobs: uses: actions/setup-node@v4 with: node-version: "22.x" + cache: "npm" - name: Build Next.js app - run: npm run build + run: npm run build --if-present - name: Install production dependencies only run: | From 0f21be7d7da7c020e933fbb8fcdaf4fb6a46d7e3 Mon Sep 17 00:00:00 2001 From: chrisdca Date: Tue, 30 Sep 2025 16:10:21 -0500 Subject: [PATCH 5/9] feat: add install --- .github/workflows/workflow-azure-web-app.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/workflow-azure-web-app.yml b/.github/workflows/workflow-azure-web-app.yml index 134b610..6322763 100644 --- a/.github/workflows/workflow-azure-web-app.yml +++ b/.github/workflows/workflow-azure-web-app.yml @@ -14,8 +14,11 @@ jobs: node-version: "22.x" cache: "npm" - - name: Build Next.js app - run: npm run build --if-present + - name: "npm install, build, and test" + run: | + npm ci + npm run build --if-present + npm run test --if-present - name: Install production dependencies only run: | From 39a2f0411833f4e4a4a469ddf793a9a6ec02a33e Mon Sep 17 00:00:00 2001 From: chrisdca Date: Tue, 30 Sep 2025 16:41:22 -0500 Subject: [PATCH 6/9] feat: update next execute --- .github/workflows/workflow-azure-web-app.yml | 7 +------ package.json | 4 ++-- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/.github/workflows/workflow-azure-web-app.yml b/.github/workflows/workflow-azure-web-app.yml index 6322763..f2841b9 100644 --- a/.github/workflows/workflow-azure-web-app.yml +++ b/.github/workflows/workflow-azure-web-app.yml @@ -16,15 +16,10 @@ jobs: - name: "npm install, build, and test" run: | - npm ci + npm install npm run build --if-present npm run test --if-present - - name: Install production dependencies only - run: | - rm -rf node_modules - npm ci --only=production - - name: "Run Azure webapp deploy action using publish profile credentials" uses: azure/webapps-deploy@v2.2.17 with: diff --git a/package.json b/package.json index 483e34e..8f17332 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "scripts": { "dev": "next dev", "build": "next build", - "start": "next start", + "start": "node_modules/next/dist/bin/next start", "lint": "next lint", "test": "vitest" }, @@ -27,4 +27,4 @@ "typescript": "^5", "vitest": "^3.1.4" } -} +} \ No newline at end of file From d5a4fc0a7bf0be075dbccda4ba9cab5a10536e66 Mon Sep 17 00:00:00 2001 From: chrisdca Date: Wed, 1 Oct 2025 22:36:54 -0500 Subject: [PATCH 7/9] chore: update start script --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 8f17332..83a4c51 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "scripts": { "dev": "next dev", "build": "next build", - "start": "node_modules/next/dist/bin/next start", + "start": "next start", "lint": "next lint", "test": "vitest" }, From d751f029f446af32eb60f4ae00c5258b0ff0f95e Mon Sep 17 00:00:00 2001 From: chrisdca Date: Wed, 1 Oct 2025 22:37:53 -0500 Subject: [PATCH 8/9] feat: update trigger --- .github/workflows/workflow-azure-web-app.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/workflow-azure-web-app.yml b/.github/workflows/workflow-azure-web-app.yml index f2841b9..241051e 100644 --- a/.github/workflows/workflow-azure-web-app.yml +++ b/.github/workflows/workflow-azure-web-app.yml @@ -1,5 +1,5 @@ name: Build and deploy Node.js app to Azure Web App -on: push +on: workflow_dispatch jobs: build-and-deploy: From 330cbb918bc68c8539b4bc103a3fd8fc26a5303e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20D=C3=ADaz?= <164126437+christianncode@users.noreply.github.com> Date: Wed, 1 Oct 2025 22:39:39 -0500 Subject: [PATCH 9/9] Potential fix for code scanning alert no. 17: Workflow does not contain permissions Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- .github/workflows/workflow-azure-web-app.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/workflow-azure-web-app.yml b/.github/workflows/workflow-azure-web-app.yml index 241051e..d40ffad 100644 --- a/.github/workflows/workflow-azure-web-app.yml +++ b/.github/workflows/workflow-azure-web-app.yml @@ -3,6 +3,8 @@ on: workflow_dispatch jobs: build-and-deploy: + permissions: + contents: read runs-on: ubuntu-latest steps: - name: "Checkout Github Action"