-
Notifications
You must be signed in to change notification settings - Fork 37
95 lines (95 loc) · 2.61 KB
/
proxy.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
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$