Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Regularize web deploy workflow

Manav Rathie9f699d3c29a
diff --git a/.github/actions/deploy-web-app/action.yml b/.github/actions/deploy-web-app/action.yml
new file mode 100644
index 0000000000..7a134d451a
--- /dev/null
+++ b/.github/actions/deploy-web-app/action.yml
@@ -0,0 +1,25 @@
+name: "Deploy web app"
+description: "Build a web app and publish it to Cloudflare Pages"
+
+inputs:
+ app:
+ description: "Web app slug"
+ required: true
+ output:
+ description: "Build output directory within web/apps/<app>"
+ default: "out"
+
+runs:
+ using: "composite"
+ steps:
+ - name: Build ${{ inputs.app }}
+ shell: bash
+ working-directory: web
+ run: yarn build:${{ inputs.app }}
+
+ - name: Publish ${{ inputs.app }}
+ uses: cloudflare/wrangler-action@v3
+ with:
+ accountId: ${{ env.CLOUDFLARE_ACCOUNT_ID }}
+ apiToken: ${{ env.CLOUDFLARE_API_TOKEN }}
+ command: pages deploy --project-name=ente --commit-dirty=true --branch=deploy/${{ inputs.app }} web/apps/${{ inputs.app }}/${{ inputs.output }}
diff --git a/.github/workflows/web-deploy.yml b/.github/workflows/web-deploy.yml
index 9a483af2e1..3c0ff98a18 100644
--- a/.github/workflows/web-deploy.yml
+++ b/.github/workflows/web-deploy.yml
@@ -30,6 +30,10 @@ jobs:
run:
working-directory: web
+ env:
+ CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
+ CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
+
steps:
- name: Checkout code
uses: actions/checkout@v6
@@ -59,132 +63,68 @@ jobs:
exit 1
fi
- - name: Build photos
- run: yarn build:photos
-
- - name: Publish photos
- uses: cloudflare/wrangler-action@v3
+ - name: Deploy photos
+ uses: ./.github/actions/deploy-web-app
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
+ app: photos
- - name: Build custom-albums
- run: yarn build:albums
-
- - name: Publish custom-albums
- uses: cloudflare/wrangler-action@v3
+ - name: Deploy albums
+ uses: ./.github/actions/deploy-web-app
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/albums/out
-
- - name: Build accounts
- run: yarn build:accounts
+ app: albums
- - name: Publish accounts
- uses: cloudflare/wrangler-action@v3
+ - name: Deploy accounts
+ uses: ./.github/actions/deploy-web-app
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
+ app: accounts
- - name: Build auth
- run: yarn build:auth
-
- - name: Publish auth
- uses: cloudflare/wrangler-action@v3
+ - name: Deploy auth
+ uses: ./.github/actions/deploy-web-app
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 legacy
- run: yarn build:legacy
+ app: auth
- - name: Publish legacy
- uses: cloudflare/wrangler-action@v3
+ - name: Deploy legacy
+ uses: ./.github/actions/deploy-web-app
with:
- accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
- apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
- command: pages deploy --project-name=ente --commit-dirty=true --branch=deploy/legacy web/apps/legacy/out
-
- - name: Build cast
- run: yarn build:cast
+ app: legacy
- - name: Publish cast
- uses: cloudflare/wrangler-action@v3
+ - name: Deploy cast
+ uses: ./.github/actions/deploy-web-app
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
+ app: cast
- - name: Build payments
- run: yarn build:payments
-
- - name: Publish payments
- uses: cloudflare/wrangler-action@v3
+ - name: Deploy payments
+ uses: ./.github/actions/deploy-web-app
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
+ app: payments
+ output: dist
- - name: Publish locker
- uses: cloudflare/wrangler-action@v3
+ - name: Deploy locker
+ uses: ./.github/actions/deploy-web-app
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
+ app: locker
- - name: Build public locker
- run: yarn build:share
-
- - name: Publish public locker
- uses: cloudflare/wrangler-action@v3
+ - name: Deploy share
+ uses: ./.github/actions/deploy-web-app
with:
- accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
- apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
- command: pages deploy --project-name=ente --commit-dirty=true --branch=deploy/share web/apps/share/out
-
- - name: Build memories
- run: yarn build:memories
+ app: share
- - name: Publish memories
- uses: cloudflare/wrangler-action@v3
+ - name: Deploy memories
+ uses: ./.github/actions/deploy-web-app
with:
- accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
- apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
- command: pages deploy --project-name=ente --commit-dirty=true --branch=deploy/memories web/apps/memories/out
+ app: memories
- - name: Build paste
- run: yarn build:paste
-
- - name: Publish paste
- uses: cloudflare/wrangler-action@v3
+ - name: Deploy paste
+ uses: ./.github/actions/deploy-web-app
with:
- accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
- apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
- command: pages deploy --project-name=ente --commit-dirty=true --branch=deploy/paste web/apps/paste/out
-
- - name: Build embed
- run: yarn build:embed
+ app: paste
- - name: Publish embed
- uses: cloudflare/wrangler-action@v3
+ - name: Deploy embed
+ uses: ./.github/actions/deploy-web-app
with:
- accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
- apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
- command: pages deploy --project-name=ente --commit-dirty=true --branch=deploy/embed web/apps/embed/out
-
- - name: Build ensu
- run: yarn build:ensu
+ app: embed
- - name: Publish ensu
- uses: cloudflare/wrangler-action@v3
+ - name: Deploy ensu
+ uses: ./.github/actions/deploy-web-app
with:
- accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
- apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
- command: pages deploy --project-name=ente --commit-dirty=true --branch=deploy/ensu web/apps/ensu/out
+ app: ensu
diff --git a/infra/services/caddy/Caddyfile b/infra/services/caddy/Caddyfile
index 008e7d8c1b..87bb45b248 100644
--- a/infra/services/caddy/Caddyfile
+++ b/infra/services/caddy/Caddyfile
@@ -9,7 +9,7 @@ https:// {
tls {
on_demand
}
- reverse_proxy https://custom-albums.ente.com {
+ reverse_proxy https://albums.ente.com {
header_up Host {upstream_hostport}
}
}