1+ name : Deploy website
2+
3+ on :
4+ push :
5+ branches :
6+ - main
7+ paths :
8+ - ' website/**'
9+ workflow_dispatch :
10+
11+ jobs :
12+ deploy :
13+ environment : release
14+ runs-on : ubuntu-latest
15+ permissions :
16+ contents : write
17+ deployments : write
18+ statuses : write
19+ pull-requests : write
20+
21+ steps :
22+ - name : Checkout main branch
23+ uses : actions/checkout@v4
24+
25+ - name : Deploy website directory to website branch
26+ uses : peaceiris/actions-gh-pages@v4
27+ with :
28+ github_token : ${{ secrets.GITHUB_TOKEN }}
29+ publish_dir : ./website
30+ publish_branch : website
31+ keep_files : true
32+ destination_dir : api
33+ user_name : ' github-actions[bot]'
34+ user_email : ' github-actions[bot]@users.noreply.github.com'
35+ commit_message : ${{ github.event.head_commit.message }}
36+
37+ - name : Set up Python 3.12
38+ uses : actions/setup-python@v3
39+ with :
40+ python-version : " 3.12"
41+
42+ - name : Install dependencies
43+ run : |
44+ python -m pip install --upgrade pip
45+ if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
46+ pip install cryptography scratchattach
47+
48+ - name : Generate and mask Vercel secrets
49+ id : generate_vars
50+ env :
51+ FERNET_KEY : ${{ secrets.FERNET_KEY }}
52+ run : |
53+ cd tests
54+ # Extract secrets securely
55+ vercel_token_val=$(python -m util vercel | sed -n '1p')
56+ org_id_val=$(python -m util vercel | sed -n '2p')
57+ project_id_val=$(python -m util vercel | sed -n '3p')
58+
59+ # Mask values so they never appear in logs
60+ echo "::add-mask::$vercel_token_val"
61+ echo "::add-mask::$org_id_val"
62+ echo "::add-mask::$project_id_val"
63+
64+ # Store them as environment variables (scoped to this job)
65+ echo "vercel_token=$vercel_token_val" >> $GITHUB_ENV
66+ echo "org_id=$org_id_val" >> $GITHUB_ENV
67+ echo "project_id=$project_id_val" >> $GITHUB_ENV
68+
69+ cd ..
70+ shell : bash
71+
72+ - name : Checkout website branch
73+ uses : actions/checkout@v4
74+ with :
75+ ref : ' website'
76+
77+ - uses : nexterias/actions-vercel@v1
78+ id : vercel
79+ with :
80+ token : ${{ env.vercel_token }}
81+ org-id : ${{ env.org_id }}
82+ project-id : ${{ env.project_id }}
83+ production : true
84+ prebuilt : true
0 commit comments