From b93bc8e612d21c44acb7753387a9ba2faf9decd6 Mon Sep 17 00:00:00 2001 From: Robert Gruen Date: Thu, 31 Oct 2024 16:05:33 -0700 Subject: [PATCH] modified deployment script. --- .../dev-robgruen-android_typeagent.yml | 147 +++++++++++------- 1 file changed, 92 insertions(+), 55 deletions(-) diff --git a/.github/workflows/dev-robgruen-android_typeagent.yml b/.github/workflows/dev-robgruen-android_typeagent.yml index 77bff09eb..2d647b7c6 100644 --- a/.github/workflows/dev-robgruen-android_typeagent.yml +++ b/.github/workflows/dev-robgruen-android_typeagent.yml @@ -1,52 +1,89 @@ -# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy -# More GitHub Actions for Azure: https://github.com/Azure/actions - -name: Build and deploy Node.js app to Azure Web App - typeagent - -on: - push: - branches: - - dev/robgruen/android - workflow_dispatch: - -jobs: - build: - runs-on: windows-latest - - steps: - - uses: actions/checkout@v4 - - - name: Set up Node.js version - uses: actions/setup-node@v3 - with: - node-version: '20.x' - - - name: npm install, build, and test - run: | - npm install - npm run build --if-present - npm run test --if-present - - - name: Upload artifact for deployment job - uses: actions/upload-artifact@v4 - with: - name: node-app - path: . - - deploy: - runs-on: ubuntu-latest - needs: build - environment: - name: 'Production' - url: ${{ steps.deploy-to-webapp.outputs.webapp-url }} +# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy +# More GitHub Actions for Azure: https://github.com/Azure/actions + +name: Build and deploy Node.js app to Azure Web App - typeagent + +on: + push: + branches: + - dev/robgruen/android + workflow_dispatch: + +jobs: + build_ts: + strategy: + fail-fast: false + matrix: + os: ["windows-latest"] + #os: ["ubuntu-latest", "windows-latest", "macos-latest"] + #version: [18, 20] + version: [20] + + runs-on: ${{ matrix.os }} + steps: + - name: Setup Git LF + run: | + git config --global core.autocrlf false + - uses: actions/checkout@v4 + - uses: dorny/paths-filter@v3 + id: filter + with: + filters: | + ts: + - "ts/**" + - ".github/workflows/build-ts.yml" + - uses: pnpm/action-setup@v4 + if: ${{ github.event_name != 'pull_request' || steps.filter.outputs.ts == 'true' }} + name: Install pnpm + with: + version: 9 + run_install: false + - uses: actions/setup-node@v4 + if: ${{ github.event_name != 'pull_request' || steps.filter.outputs.ts == 'true' }} + with: + node-version: ${{ matrix.version }} + cache: "pnpm" + cache-dependency-path: ts/pnpm-lock.yaml + - name: Install dependencies + if: ${{ github.event_name != 'pull_request' || steps.filter.outputs.ts == 'true' }} + working-directory: ts + run: | + pnpm install --frozen-lockfile --strict-peer-dependencies + - name: Build + if: ${{ github.event_name != 'pull_request' || steps.filter.outputs.ts == 'true' }} + working-directory: ts + run: | + npm run build + - name: Test + if: ${{ github.event_name != 'pull_request' || steps.filter.outputs.ts == 'true' }} + working-directory: ts + run: | + npm run test + - name: Lint + if: ${{ github.event_name != 'pull_request' || steps.filter.outputs.ts == 'true' }} + working-directory: ts + run: | + npm run lint + - name: Upload artifact for deployment job + uses: actions/upload-artifact@v4 + with: + name: node-app + path: ./ts + + deploy: + runs-on: ubuntu-latest + needs: build_ts + environment: + name: 'test' + url: ${{ steps.deploy-to-webapp.outputs.webapp-url }} permissions: id-token: write #This is required for requesting the JWT - - steps: - - name: Download artifact from build job - uses: actions/download-artifact@v4 - with: - name: node-app + + steps: + - name: Download artifact from build job + uses: actions/download-artifact@v4 + with: + name: node-app - name: Login to Azure uses: azure/login@v2 @@ -54,12 +91,12 @@ jobs: client-id: ${{ secrets.AZUREAPPSERVICE_CLIENTID_B4797564A45B4B2CAEF5F113E8617853 }} tenant-id: ${{ secrets.AZUREAPPSERVICE_TENANTID_0611664DD86346ACAAB76A0B1D0581EE }} subscription-id: ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID_D685C18460584CADB3CABB18FCA57D30 }} - - - name: 'Deploy to Azure Web App' - uses: azure/webapps-deploy@v3 - id: deploy-to-webapp - with: - app-name: 'typeagent' - slot-name: 'Production' - package: . + + - name: 'Deploy to Azure Web App' + uses: azure/webapps-deploy@v3 + id: deploy-to-webapp + with: + app-name: 'typeagent' + slot-name: 'test' + package: . \ No newline at end of file