chore: bump @types/node from 20.14.9 to 20.14.10 in the types group (… #11311
This file contains 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: CD Azure | |
on: | |
push: | |
branches: | |
- main | |
permissions: | |
pull-requests: write | |
id-token: write | |
jobs: | |
build_and_deploy: | |
name: Build & Deploy to ${{ matrix.environment }} | |
runs-on: windows-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- environment: Test | |
url: https://dev.www.jabref.org | |
deployment_environment: dev | |
- environment: Staging | |
url: https://staging.www.jabref.org | |
deployment_environment: staging | |
- environment: Production | |
url: https://www.jabref.org | |
deployment_environment: default | |
environment: | |
name: ${{ matrix.environment }} | |
url: ${{ matrix.url }} | |
env: | |
DATABASE_URL: ${{ matrix.environment == 'Test' && secrets.AZURE_TEST_DATABASE_URL || secrets.AZURE_DATABASE_URL }} | |
GITHUB_REPO_TOKEN: ${{ secrets.GITHUBS_REPO_TOKEN }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4.1.7 | |
- name: Install pnpm | |
uses: pnpm/action-setup@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4.0.2 | |
with: | |
node-version: 20 | |
cache: 'pnpm' | |
- name: Install dependencies | |
run: pnpm install | |
- name: Reset Test database on Azure | |
if: matrix.environment == 'Test' | |
run: pnpm prisma:migrate:reset --force | |
- name: Update Production database on Azure | |
if: matrix.environment == 'Staging' | |
run: pnpm prisma:migrate:deploy | |
- name: Build | |
run: pnpm build:azure | |
- name: Login to Azure | |
uses: Azure/login@v2 | |
with: | |
client-id: ${{ secrets.AZURE_CLIENT_ID }} | |
tenant-id: ${{ secrets.AZURE_TENANT_ID }} | |
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | |
- name: Deploy Web App | |
run: | | |
# Delete old deployment (otherwise we get a spawn EBUSY error when running the workflow again) | |
az staticwebapp environment delete --name jabref-online --environment-name ${{ matrix.deployment_environment }} --yes || true | |
pnpm swa deploy .output\public --env ${{ matrix.deployment_environment }} | |
env: | |
SWA_CLI_DEPLOYMENT_TOKEN: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_MANGO_PEBBLE_0224C3803 }} | |
- name: Install Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
- name: Create & Link Function App | |
run: | | |
pip install azure-identity azure-mgmt-web azure-mgmt-storage azure-mgmt-applicationinsights azure-mgmt-redis azure-mgmt-communication | |
python .github\scripts\deploy.py --env ${{ matrix.deployment_environment }} | |
env: | |
SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | |
AZURE_SESSION_SECRET: ${{ secrets.AZURE_SESSION_SECRET }} | |
- name: Deploy Function App | |
run: | | |
# Nuxt/nitro creates symlinks to replicate parts of the node_modules folder | |
# if multiple versions of the same package are used. | |
# However, these symlinks are not preserved by Compress-Archive, and even they were, Azure has problems with symlinks: | |
# https://github.com/Azure/webapps-deploy/issues/54 | |
# Therefore, replace all symlinks by the actual files | |
$links = Get-ChildItem -Path .output\server -Attributes ReparsePoint -Recurse | |
foreach ($link in $links) | |
{ | |
$source = $link.Target; | |
$destination = $link.FullName; | |
Remove-Item $destination -Force | |
Copy-Item -Path $source -Destination $destination -Force -Recurse | |
} | |
Compress-Archive -Path .output\server\* -DestinationPath .output\server.zip | |
az functionapp deployment source config-zip -g JabRefOnline -n jabref-function-${{ matrix.deployment_environment }} --src .output\server.zip | |
- name: Check HTTP status | |
run: | | |
Start-Sleep -Seconds 30 | |
curl -s -w 'Establish Connection: %{time_connect}s\nTTFB: %{time_starttransfer}s\nTotal: %{time_total}s\n' ${{ matrix.url }} || true | |
curl -s -w 'Establish Connection: %{time_connect}s\nTTFB: %{time_starttransfer}s\nTotal: %{time_total}s\n' ${{ matrix.url }}/api || true | |
# The api returns 400 status code for some reason | |
# with: | |
# url: ${{ matrix.url }}/api | |
# code: 200 | |
# timeout: 300 # initial warm up can take quite some time | |
# interval: 30 | |
- name: Run API tests | |
run: pnpm test:api | |
env: | |
TEST_URL: ${{ matrix.url }} |