Skip to content

Commit

Permalink
modified deployment script.
Browse files Browse the repository at this point in the history
  • Loading branch information
robgruen committed Oct 31, 2024
1 parent 2bc9894 commit b93bc8e
Showing 1 changed file with 92 additions and 55 deletions.
147 changes: 92 additions & 55 deletions .github/workflows/dev-robgruen-android_typeagent.yml
Original file line number Diff line number Diff line change
@@ -1,65 +1,102 @@
# 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
with:
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: .

0 comments on commit b93bc8e

Please sign in to comment.