Skip to content

Update dependencies #66

Update dependencies

Update dependencies #66

Workflow file for this run

name: Server
on:
push:
branches:
- main
paths:
- 'server/*'
- 'server/**/*'
- '!server/*.md'
- 'pnpm-lock.yaml'
- '.github/workflows/server.yml'
- '.github/actions/init-node/action.yml'
- '.github/actions/deploy/action.yml'
pull_request:
paths:
- 'server/*'
- 'server/**/*'
- '!server/*.md'
- 'pnpm-lock.yaml'
- '.github/workflows/server.yml'
- '.github/actions/init-node/action.yml'
- '.github/actions/deploy/action.yml'
jobs:
test:
name: Server Test
permissions:
contents: read
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/[email protected]
- name: Initialize Node.js
uses: ./.github/actions/init-node
- name: Run tests
run: cd server && pnpm test
build:
name: Server Build
if: github.ref == 'refs/heads/main'
permissions:
contents: read
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/[email protected]
- name: Initialize Node.js
uses: ./.github/actions/init-node
with:
cache: false
install: -F server -F proxy -F api --prod
- name: Build server
run: cd server && node --run build:server
- name: Create archive to keep symlinks
run: tar -cf server.tar server/dist/
- name: Upload server build
uses: actions/[email protected]
with:
name: server-build-${{ github.sha }}
retention-days: 1
path: |
./server.tar
staging:
name: Server Staging Deploy
needs:
- test
- build
if: github.ref == 'refs/heads/main'
permissions:
contents: read
id-token: write
concurrency:
group: staging-server
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/[email protected]
- name: Download web assets from test step
uses: actions/[email protected]
with:
name: server-build-${{ github.sha }}
path: ./
- name: Extract archive to restore symlinks
run: tar -xf server.tar
- name: Create empty assets
run: mkdir server/web
- name: Deploy to Google Cloud
uses: ./.github/actions/deploy
with:
projectId: slowreader-421120
region: europe-west1
folder: ./server/
registry: staging/server
service: staging-server
env: ASSETS=,PROXY_ORIGIN=
# Persistent database was disable temporary to save money
# flags: |
# --vpc-connector db-connector
# --update-secrets=DATABASE_URL=staging-db-url:latest
flags: |
--update-secrets=DATABASE_URL=preview-db-url:latest