Update dependencies #210
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: Proxy | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- 'proxy/*' | |
- '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/**/*' | |
- '!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/[email protected] | |
- 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 the repository | |
uses: actions/[email protected] | |
- name: Initialize Node.js | |
uses: ./.github/actions/init-node | |
with: | |
cache: false | |
install: -F proxy --prod | |
- name: Build server | |
run: cd proxy && node --run build | |
- name: Create archive to keep symlinks | |
run: tar -cf proxy.tar proxy/dist/ | |
- name: Upload proxy build | |
uses: actions/[email protected] | |
with: | |
name: proxy-build-${{ github.sha }} | |
retention-days: 1 | |
include-hidden-files: true | |
path: | | |
./proxy.tar | |
staging: | |
name: Proxy Staging Deploy | |
needs: | |
- test | |
- build | |
if: github.ref == 'refs/heads/main' | |
permissions: | |
contents: read | |
id-token: write | |
concurrency: | |
group: staging-proxy | |
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: proxy-build-${{ github.sha }} | |
path: ./ | |
- name: Extract archive to restore symlinks | |
run: tar -xf proxy.tar | |
- 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,PROXY_ORIGIN=^https:\/\/dev\.slowreader\.app$ |