Skip to content

chore(deps): update graphql (#2566) #11399

chore(deps): update graphql (#2566)

chore(deps): update graphql (#2566) #11399

Workflow file for this run

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 }}
NUXT_SESSION_PASSWORD: ${{ secrets.AZURE_SESSION_SECRET }}
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Install pnpm
uses: pnpm/action-setup@v4
- name: Setup Node.js
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
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@a65d910e8af852a8061c627c456678983e180302 # 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@0b93645e9fea7318ecaed2b359559ac225c90a2b # 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 }}
- 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 E2E tests
run: pnpm test:e2e
env:
TEST_URL: ${{ matrix.url }}