Skip to content

--- (#216)

--- (#216) #72

Workflow file for this run

name: Proxy
on:
push:
branches:
- main
paths:
- 'proxy/**/*'
- '!proxy/*.md'
- 'pnpm-lock.yaml'
- '.github/workflows/proxy.yml'
- '.github/actions/init-node/action.yml'
- '.github/actions/deploy/action.yml'
pull_request:
paths:
- 'proxy/**/*'
- '!proxy/*.md'
- 'pnpm-lock.yaml'
- '.github/workflows/proxy.yml'
- '.github/actions/init-node/action.yml'
- '.github/actions/deploy/action.yml'
jobs:
test:
name: Proxy Test
permissions:
contents: read
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v4
- name: Initialize Node.js
uses: ./.github/actions/init-node
- name: Run tests
run: cd proxy && pnpm test
- name: Test Docker build
if: github.ref != 'refs/heads/main'
run: cd proxy && node --run build && docker build .
build:
name: Proxy Build
if: github.ref == 'refs/heads/main'
permissions:
contents: read
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version-file: .node-version
# We don’t use cache for supply chain security
- name: Allow to install only project dependencies
run: pnpm config set recursive-install false
- name: Install dependencies
run: cd proxy && pnpm install --production --ignore-scripts
- name: Build JS file
run: cd proxy && node --run build
- name: Upload proxy build
uses: actions/upload-artifact@v4
with:
name: proxy-build-${{ github.sha }}
path: |
proxy/dist/
retention-days: 1
staging:
name: Proxy Staging Deploy
needs:
- test
- build
if: github.ref == 'refs/heads/main'
permissions:
contents: read
id-token: write
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download web assets from test step
uses: actions/download-artifact@v4
with:
name: proxy-build-${{ github.sha }}
path: proxy/dist/
- name: Deploy to Google Cloud
uses: ./.github/actions/deploy
with:
projectId: slowreader-421120
region: europe-west1
folder: ./proxy/
registry: staging/proxy
service: staging-proxy
env: STAGING=1