Skip to content
This repository was archived by the owner on Jan 30, 2026. It is now read-only.

Commit 0b72b26

Browse files
fix: fixed workflows for github
1 parent a0df722 commit 0b72b26

3 files changed

Lines changed: 46 additions & 62 deletions

File tree

.github/workflows/deploy-demo.yml

Lines changed: 45 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,74 +1,63 @@
1-
name: Deploy Proxy Server to GCP
1+
name: Deploy Demo
22

33
on:
4+
push:
5+
branches: [main]
6+
paths:
7+
- "demo/**"
8+
- "!**.md"
49
workflow_dispatch:
5-
inputs:
6-
deploy_env:
7-
description: 'Environment label (optional)'
8-
required: false
910

10-
env:
11-
PROJECT_ID: ${{ vars.GCP_PROJECT_ID }}
12-
REGION: ${{ vars.GCP_REGION }}
13-
SERVICE_NAME: ${{ vars.GCP_SERVICE_NAME }}
14-
SUPERDOC_SERVICES_API_KEY: ${{ secrets.SUPERDOC_SERVICES_API_KEY }}
15-
SUPERDOC_SERVICES_BASE_URL: ${{ vars.SUPERDOC_SERVICES_BASE_URL }}
11+
permissions:
12+
contents: read
13+
pages: write
14+
id-token: write
1615

1716
jobs:
1817
deploy:
1918
runs-on: ubuntu-latest
20-
permissions:
21-
contents: read
22-
id-token: write
23-
19+
environment:
20+
name: github-pages
21+
url: ${{ steps.deployment.outputs.page_url }}
2422
steps:
25-
- name: Checkout
26-
uses: actions/checkout@v5
27-
28-
- name: Auth to Google Cloud
29-
uses: google-github-actions/auth@v2
23+
- name: Generate token
24+
id: generate_token
25+
uses: actions/create-github-app-token@v2
3026
with:
31-
credentials_json: ${{ secrets.GCP_SA_KEY }}
27+
app-id: ${{ secrets.APP_ID }}
28+
private-key: ${{ secrets.APP_PRIVATE_KEY }}
3229

33-
- name: Setup gcloud
34-
uses: google-github-actions/setup-gcloud@v2
30+
- uses: actions/checkout@v5
3531
with:
36-
project_id: ${{ env.PROJECT_ID }}
32+
fetch-depth: 0
33+
token: ${{ steps.generate_token.outputs.token }}
3734

38-
- name: Build and push container with Cloud Build
39-
run: |
40-
REGION="${REGION:-us-central1}"
41-
SERVICE_NAME="${SERVICE_NAME:-esign-demo-proxy-server}"
42-
IMAGE="gcr.io/${PROJECT_ID}/${SERVICE_NAME}:${GITHUB_SHA}"
35+
- uses: pnpm/action-setup@v2
36+
with:
37+
version: 9
4338

44-
echo "REGION=${REGION}" >> $GITHUB_ENV
45-
echo "SERVICE_NAME=${SERVICE_NAME}" >> $GITHUB_ENV
46-
echo "IMAGE=${IMAGE}" >> $GITHUB_ENV
39+
- uses: actions/setup-node@v3
40+
with:
41+
node-version: 20
42+
cache: "pnpm"
4743

48-
gcloud builds submit demo/server --tag "${IMAGE}"
44+
- name: Install and Build
4945
env:
50-
PROJECT_ID: ${{ env.PROJECT_ID }}
51-
REGION: ${{ env.REGION }}
52-
SERVICE_NAME: ${{ env.SERVICE_NAME }}
53-
54-
- name: Deploy container to Cloud Run
46+
VITE_SUPERDOC_SERVICES_API_KEY: ${{ secrets.VITE_SUPERDOC_SERVICES_API_KEY }}
5547
run: |
56-
REGION="${REGION:-us-central1}"
57-
SERVICE_NAME="${SERVICE_NAME:-esign-demo-proxy-server}"
58-
IMAGE="${IMAGE}"
59-
SUPERDOC_SERVICES_BASE_URL="${SUPERDOC_SERVICES_BASE_URL:-https://api.superdoc.dev}"
48+
pnpm install
49+
rm -rf dist
50+
pnpm build
51+
cd demo
52+
rm -rf node_modules dist
53+
pnpm install
54+
pnpm build
55+
56+
- name: Upload artifact
57+
uses: actions/upload-pages-artifact@v4
58+
with:
59+
path: ./demo/dist
6060

61-
gcloud run deploy "${SERVICE_NAME}" \
62-
--image "${IMAGE}" \
63-
--region "${REGION}" \
64-
--memory=1Gi \
65-
--cpu=1 \
66-
--allow-unauthenticated \
67-
--set-env-vars SUPERDOC_SERVICES_BASE_URL="${SUPERDOC_SERVICES_BASE_URL}" \
68-
--set-secrets="SUPERDOC_SERVICES_API_KEY=esign-demo-sd-services-api-key:latest"
69-
env:
70-
IMAGE: ${{ env.IMAGE }}
71-
REGION: ${{ env.REGION }}
72-
SERVICE_NAME: ${{ env.SERVICE_NAME }}
73-
SUPERDOC_SERVICES_API_KEY: ${{ env.SUPERDOC_SERVICES_API_KEY }}
74-
SUPERDOC_SERVICES_BASE_URL: ${{ env.SUPERDOC_SERVICES_BASE_URL }}
61+
- name: Deploy to GitHub Pages
62+
id: deployment
63+
uses: actions/deploy-pages@v4
Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
1-
name: Deploy Proxy Server to GCP
1+
name: Deploy Proxy Server
22

33
on:
44
workflow_dispatch:
5-
inputs:
6-
deploy_env:
7-
description: 'Environment label (optional)'
8-
required: false
95

106
env:
117
PROJECT_ID: ${{ vars.GCP_PROJECT_ID }}

demo/server/server.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ const SUPERDOC_SERVICES_BASE_URL =
1212
const CONSENT_FIELD_IDS = new Set(['consent_agreement', 'terms', 'email', '406948812']);
1313
const SIGNATURE_FIELD_ID = '789012';
1414

15-
// TODO: tighten origin allowlist when the frontend URL is known.
1615
app.use(
1716
cors({
1817
origin: 'https://esign.superdoc.dev',

0 commit comments

Comments
 (0)