Package Azure deploy artifact as zip #3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Deploy App Service | |
| on: | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| env: | |
| FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true | |
| concurrency: | |
| group: deploy-appservice-production | |
| cancel-in-progress: true | |
| jobs: | |
| build: | |
| name: Build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 24 | |
| cache: npm | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build application | |
| run: npm run build | |
| - name: Trim dev dependencies | |
| run: npm prune --omit=dev | |
| - name: Package deployment payload | |
| run: | | |
| set -eux | |
| rm -rf deploy | |
| mkdir -p deploy | |
| rsync -a .next/ deploy/.next/ | |
| rsync -a node_modules/ deploy/node_modules/ | |
| mkdir -p deploy/src/generated | |
| rsync -a src/generated/ deploy/src/generated/ | |
| cp package.json deploy/package.json | |
| cp next.config.ts deploy/next.config.ts | |
| cp startup.sh deploy/startup.sh | |
| if [ -f package-lock.json ]; then | |
| cp package-lock.json deploy/package-lock.json | |
| fi | |
| if [ -d public ]; then | |
| rsync -a public/ deploy/public/ | |
| fi | |
| if [ -d prisma ]; then | |
| rsync -a prisma/ deploy/prisma/ | |
| fi | |
| rm -rf deploy/.next/cache | |
| cd deploy | |
| zip -qry ../webapp-package.zip . | |
| - name: Upload deployment artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: webapp-package | |
| path: webapp-package.zip | |
| if-no-files-found: error | |
| deploy: | |
| name: Deploy | |
| runs-on: ubuntu-latest | |
| needs: build | |
| environment: | |
| name: production | |
| url: https://exam-cooker.acmvit.in | |
| steps: | |
| - name: Download deployment artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: webapp-package | |
| path: . | |
| - name: Deploy to Azure App Service | |
| uses: azure/webapps-deploy@v3 | |
| with: | |
| app-name: examcooker-2024 | |
| publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }} | |
| package: webapp-package.zip |