Skip to content

Update packages and fix regressions #17

Update packages and fix regressions

Update packages and fix regressions #17

name: Build and deploy Next.js app to Azure Web App - app-skplayground-web-prod-001
on:
push:
branches:
- main
paths:
- "frontend/**"
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Node.js version
uses: actions/setup-node@v1
with:
node-version: "18.x"
- name: npm install and build
run: |
cd frontend
npm install
npm run build
cd ..
env:
NEXT_PUBLIC_APP_URL: ${{ vars.NEXT_PUBLIC_APP_URL }}
NEXT_PUBLIC_APP_INSIGHTS_CONNECTION_STRING: ${{ vars.NEXT_PUBLIC_APP_INSIGHTS_CONNECTION_STRING }}
NEXT_PUBLIC_AUTH_CLIENT_ID: ${{ vars.NEXT_PUBLIC_AUTH_CLIENT_ID }}
NEXT_PUBLIC_AUTH_API_CLIENT_ID: ${{ vars.NEXT_PUBLIC_AUTH_API_CLIENT_ID }}
NEXT_PUBLIC_API_URL: ${{ vars.NEXT_PUBLIC_API_URL }}
NEXT_PUBLIC_API_VERSION: ${{ vars.NEXT_PUBLIC_API_VERSION }}
SKPLAYGROUND_GITHUB_ACCESS_TOKEN: ${{ secrets.SKPLAYGROUND_GITHUB_ACCESS_TOKEN }}
- name: Copy files for deployment
run: |
mkdir -p frontend/.next/standalone/.next/static
mkdir -p frontend/.next/standalone/public
cp -r frontend/.next/static/* frontend/.next/standalone/.next/static/
cp -r frontend/public/* frontend/.next/standalone/public/
- name: Upload artifact for deployment job
uses: actions/upload-artifact@v2
with:
name: app
path: ./frontend/.next/standalone
deploy:
runs-on: ubuntu-latest
needs: build
environment:
name: "Production"
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}
steps:
- name: Download artifact from build job
uses: actions/download-artifact@v2
with:
name: app
- name: "Deploy to Azure Web App"
id: deploy-to-webapp
uses: azure/webapps-deploy@v2
with:
app-name: "app-skplayground-web-prod-001"
slot-name: "Production"
publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_C82531ABB7AC4299A9950937AB82B2F7 }}
package: .