From b5dfb291fb8c1a60bf4407a7819ce734807a7922 Mon Sep 17 00:00:00 2001 From: siddheshraze <81591724+siddheshraze@users.noreply.github.com> Date: Mon, 26 Feb 2024 11:42:10 -0500 Subject: [PATCH] Add or update the Azure App Service build and deployment workflow config --- ...-file-upload-system_forestgeo-livesite.yml | 65 ++++++++----------- 1 file changed, 28 insertions(+), 37 deletions(-) diff --git a/.github/workflows/new-file-upload-system_forestgeo-livesite.yml b/.github/workflows/new-file-upload-system_forestgeo-livesite.yml index 0e2289b5..4ace7443 100644 --- a/.github/workflows/new-file-upload-system_forestgeo-livesite.yml +++ b/.github/workflows/new-file-upload-system_forestgeo-livesite.yml @@ -7,17 +7,12 @@ on: push: branches: - new-file-upload-system - paths-ignore: - - "README.md" - - ".husky" - - "**/*.csv" - - .env* workflow_dispatch: jobs: - build-and-deploy: + build: runs-on: ubuntu-latest - environment: development + steps: - uses: actions/checkout@v4 @@ -26,46 +21,42 @@ jobs: with: node-version: '18.x' - - name: create frontend env file - run: | - touch frontend/.env - echo AZURE_AD_CLIENT_SECRET=${{ secrets.AZURE_AD_CLIENT_SECRET }} >> frontend/.env - echo AZURE_AD_CLIENT_ID=${{ secrets.AZURE_AD_CLIENT_ID }} >> frontend/.env - echo AZURE_AD_TENANT_ID=${{ secrets.AZURE_AD_TENANT_ID }} >> frontend/.env - echo NEXTAUTH_SECRET=${{ secrets.NEXTAUTH_SECRET }} >> frontend/.env - echo AZURE_SQL_USER=${{ secrets.AZURE_SQL_USER }} >> frontend/.env - echo AZURE_SQL_PASSWORD=${{ secrets.AZURE_SQL_PASSWORD }} >> frontend/.env - echo AZURE_SQL_SERVER=${{ secrets.AZURE_SQL_SERVER }} >> frontend/.env - echo AZURE_SQL_DATABASE=${{ secrets.AZURE_SQL_DATABASE }} >> frontend/.env - echo AZURE_SQL_PORT=${{ secrets.AZURE_SQL_PORT }} >> frontend/.env - echo AZURE_STORAGE_SAS_CONNECTION_STRING=${{ secrets.AZURE_STORAGE_SAS_CONNECTION_STRING }} >> frontend/.env - echo AZURE_SQL_SCHEMA=${{ secrets.AZURE_SQL_SCHEMA }} >> frontend/.env - echo AZURE_STORAGE_CONNECTION_STRING=${{ secrets.AZURE_STORAGE_CONNECTION_STRING }} >> frontend/.env - echo NODE_ENV=development >> frontend/.env - -# - name: Cache node modules -# uses: actions/cache@v2 -# with: -# path: frontend/node_modules -# key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} -# restore-keys: | -# ${{ runner.os }}-node- - - name: npm install, build, and test run: | - cd frontend/ npm install npm run build --if-present npm run test --if-present - name: Zip artifact for deployment - run: zip next.zip ./* .next .env -qr + run: zip release.zip ./* -r + + - name: Upload artifact for deployment job + uses: actions/upload-artifact@v3 + with: + name: node-app + path: release.zip + + 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@v3 + with: + name: node-app + + - name: Unzip artifact for deployment + run: unzip release.zip - name: 'Deploy to Azure Web App' id: deploy-to-webapp uses: azure/webapps-deploy@v2 with: app-name: 'forestgeo-livesite' - slot-name: 'production' - publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }} - package: . \ No newline at end of file + slot-name: 'Production' + publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_852346BD764D45D08854E6679137F844 }} + package: .