Deploy staging (web) #227
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: "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 |