129 lines
4.6 KiB
YAML
129 lines
4.6 KiB
YAML
name: "Deploy (web)"
|
|
|
|
on:
|
|
schedule:
|
|
# [Note: Run workflow every 24 hours]
|
|
#
|
|
# Run every weekday at ~8:00 AM IST.
|
|
#
|
|
# First field is minute, second is hour of the day. Last is day of week,
|
|
# 0 being Sunday.
|
|
#
|
|
# Add a few minutes of offset to avoid scheduling on exact hourly
|
|
# boundaries (recommended by GitHub to avoid congestion).
|
|
#
|
|
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#schedule
|
|
# https://crontab.guru/
|
|
#
|
|
- cron: "25 2 * * 1-5"
|
|
# Also allow manually running the workflow
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
deploy:
|
|
runs-on: ubuntu-latest
|
|
|
|
defaults:
|
|
run:
|
|
working-directory: web
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- name: Setup node and enable yarn caching
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 22
|
|
cache: "yarn"
|
|
cache-dependency-path: "web/yarn.lock"
|
|
|
|
- name: Install dependencies
|
|
run: yarn install --frozen-lockfile
|
|
|
|
- name: Audit dependencies
|
|
run: |
|
|
yarn audit --level critical
|
|
exit_code=$?
|
|
if [ $exit_code -ge 16 ]; then
|
|
echo "::error::Yarn audit found critical issues"
|
|
exit 1
|
|
fi
|
|
|
|
- name: Build photos
|
|
run: yarn build:photos
|
|
|
|
- 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=deploy/photos web/apps/photos/out
|
|
|
|
- name: Build custom-albums
|
|
run: yarn build:photos
|
|
env:
|
|
NEXT_PUBLIC_ENTE_ONLY_SERVE_ALBUMS_APP: 1
|
|
|
|
- name: Publish custom-albums
|
|
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=deploy/custom-albums 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=deploy/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=deploy/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=deploy/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=deploy/payments web/apps/payments/dist
|
|
|
|
- name: Build locker
|
|
run: yarn build:locker
|
|
|
|
- name: Publish locker
|
|
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=deploy/locker web/apps/locker/out
|