Skip to content

Commit

Permalink
Next client app GitHub pipeline (#666)
Browse files Browse the repository at this point in the history
* Add next-client-app

* Add scan reports data table

* Add GitHub pipeline for next app

* Update deploy.yml

* Test Next deployment on PR branch

* Update next.config.js

* Update deploy.yml
  • Loading branch information
Dev-Akashili authored Apr 8, 2024
1 parent 4d91898 commit 3ba2979
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 4 deletions.
64 changes: 64 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ on:

env:
AZURE_FUNCTIONAPP_PACKAGE_PATH: './app/workers'
AZURE_WEBAPP_PACKAGE_PATH: './app/next-client-app'
PYTHON_VERSION: '3.11'
NODE_VERSION: 20

jobs:
build-and-publish-workers:
Expand Down Expand Up @@ -70,6 +72,46 @@ jobs:
tags: ccomreg.azurecr.io/${{ secrets.REGISTRY_USERNAME_DEV }}/latest:${{ github.sha }}
file: ./app/Dockerfile.deploy

build-and-publish-next-app:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}

- name: npm install and build
run: |
npm i --workspaces=false
working-directory: ${{ env.AZURE_WEBAPP_PACKAGE_PATH }}

- name: Cache .next/cache
uses: actions/cache@v3
env:
cache-name: cache-node-modules
with:
path: ${{ env.AZURE_WEBAPP_PACKAGE_PATH }}/.next/cache
key: nextjs | $(Agent.OS) | ${{ env.AZURE_WEBAPP_PACKAGE_PATH }}/package-lock.json

- name: Build
run: npm run build --workspaces=false
working-directory: ${{ env.AZURE_WEBAPP_PACKAGE_PATH }}

- name: Copy Static Assets
run: |
cp -r .next/static .next/standalone/.next/
cp -r public .next/standalone/
working-directory: ${{ env.AZURE_WEBAPP_PACKAGE_PATH }}

- name: Publish webapp artifact
uses: actions/upload-artifact@v4
with:
path: ${{ env.AZURE_WEBAPP_PACKAGE_PATH }}/.next/standalone
name: frontendwebapp

# Deploy Workers Dev
deploy-workers-dev:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -109,6 +151,28 @@ jobs:
publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }}
images: 'ccomreg.azurecr.io/${{ secrets.REGISTRY_USERNAME_DEV }}/latest:${{ github.sha }}'

# Deploy Next.js Client App Dev
deploy-next-dev:
runs-on: ubuntu-latest
needs: [build-and-publish-next-app, deploy-web-dev]
environment: dev

steps:
- uses: actions/checkout@v2

- name: Download artifact from build job
uses: actions/download-artifact@v4
with:
path: frontendwebapp
name: frontendwebapp

- name: Deploy to Azure WebApp
uses: azure/webapps-deploy@v2
with:
app-name: 'ccom-next-dev'
publish-profile: ${{ secrets.AZURE_WEBAPP_NEXT_PUBLISH_PROFILE }}
package: ${{ github.workspace }}/frontendwebapp

# Deploy Workers Test
deploy-workers-test:
runs-on: ubuntu-latest
Expand Down
6 changes: 6 additions & 0 deletions app/next-client-app/next.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
output: "standalone",
};

module.exports = nextConfig;
4 changes: 0 additions & 4 deletions app/next-client-app/next.config.mjs

This file was deleted.

0 comments on commit 3ba2979

Please sign in to comment.