-
-
Notifications
You must be signed in to change notification settings - Fork 831
99 lines (81 loc) · 3.58 KB
/
web-deploy-staging.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
96
97
98
99
name: "Deploy staging (web)"
# Builds the "staging/web" branch if it exists, "main" otherwise.
on:
schedule:
# Run everyday at ~3:00 PM IST
#
# See: [Note: Run workflow every 24 hours]
- cron: "25 9 * * *"
# Also allow manually running the workflow
workflow_dispatch:
jobs:
deploy:
runs-on: ubuntu-latest
defaults:
run:
working-directory: web
steps:
- name: Determine branch to build
id: select-branch
working-directory: ${{ github.workspace }}
run: |
if git ls-remote --exit-code --heads https://github.com/ente-io/ente refs/heads/staging/web; then
echo "branch=staging/web" >> $GITHUB_OUTPUT
else
echo "branch=main" >> $GITHUB_OUTPUT
fi
- name: Checkout ${{ steps.select-branch.outputs.branch }}
uses: actions/checkout@v4
with:
ref: ${{ steps.select-branch.outputs.branch }}
submodules: recursive
- name: Setup node and enable yarn caching
uses: actions/setup-node@v4
with:
node-version: 20
cache: "yarn"
cache-dependency-path: "web/yarn.lock"
- name: Install dependencies
run: yarn install
- name: Build photos
run: yarn build:photos
env:
NEXT_PUBLIC_ENTE_ALBUMS_ENDPOINT: https://albums.ente.sh
- name: Publish photos
uses: cloudflare/wrangler-action@v3
with:
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
command: pages deploy --project-name=ente --commit-dirty=true --branch=n-photos web/apps/photos/out
- name: Build accounts
run: yarn build:accounts
- name: Publish accounts
uses: cloudflare/wrangler-action@v3
with:
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
command: pages deploy --project-name=ente --commit-dirty=true --branch=n-accounts web/apps/accounts/out
- name: Build auth
run: yarn build:auth
- name: Publish auth
uses: cloudflare/wrangler-action@v3
with:
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
command: pages deploy --project-name=ente --commit-dirty=true --branch=n-auth web/apps/auth/out
- name: Build cast
run: yarn build:cast
- name: Publish cast
uses: cloudflare/wrangler-action@v3
with:
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
command: pages deploy --project-name=ente --commit-dirty=true --branch=n-cast web/apps/cast/out
- name: Build payments
run: yarn build:payments
- name: Publish payments
uses: cloudflare/wrangler-action@v3
with:
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
command: pages deploy --project-name=ente --commit-dirty=true --branch=n-payments web/apps/payments/dist