Skip to content

Commit 7f20fa7

Browse files
authored
Refactor GitHub Actions for website deployment
Signed-off-by: TheCommCraft <79996518+TheCommCraft@users.noreply.github.com>
1 parent a04e6d2 commit 7f20fa7

1 file changed

Lines changed: 27 additions & 20 deletions

File tree

.github/workflows/deploy-website.yml

Lines changed: 27 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -39,35 +39,42 @@ jobs:
3939
with:
4040
python-version: "3.12"
4141

42-
- name: Install dependencies
42+
- name: Install Python deps
4343
run: |
4444
python -m pip install --upgrade pip
4545
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
4646
pip install cryptography scratchattach
4747
48-
- name: Generate Vercel secrets as environment variables (securely)
49-
id: generate_vars
48+
- name: Checkout website branch
49+
uses: actions/checkout@v4
50+
with:
51+
ref: 'website'
52+
53+
# New single-step secure deploy:
54+
- name: Generate Vercel token and deploy (keeps secrets in-step only)
5055
env:
5156
FERNET_KEY: ${{ secrets.FERNET_KEY }}
5257
run: |
58+
set -euo pipefail
59+
60+
# run token generator and capture output into variables WITHOUT printing
61+
# Adjust this read pattern if `python -m util vercel` emits a different format.
5362
cd tests
54-
eval "$(python -m util vercel | awk '
55-
NR==1 {print "echo \"vercel_token="$0"\" >> $GITHUB_ENV"}
56-
NR==2 {print "echo \"org_id="$0"\" >> $GITHUB_ENV"}
57-
NR==3 {print "echo \"project_id="$0"\" >> $GITHUB_ENV"}')"
63+
IFS=$'\n' read -r VERCEL_TOKEN ORG_ID PROJECT_ID < <(python -m util vercel)
5864
cd ..
59-
shell: bash
6065
61-
- name: Checkout website branch
62-
uses: actions/checkout@v4
63-
with:
64-
ref: 'website'
66+
# Mask the values so accidental prints later are redacted
67+
echo "::add-mask::$VERCEL_TOKEN"
68+
echo "::add-mask::$ORG_ID"
69+
echo "::add-mask::$PROJECT_ID"
6570
66-
- uses: nexterias/actions-vercel@v1
67-
id: vercel
68-
with:
69-
token: ${{ env.vercel_token }}
70-
org-id: ${{ env.org_id }}
71-
project-id: ${{ env.project_id }}
72-
production: true
73-
prebuilt: true
71+
# Install node / vercel CLI (no global logs of the token)
72+
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
73+
sudo apt-get install -y nodejs
74+
npm install -g vercel
75+
76+
# Run Vercel deploy using the token only in this step (no exporting)
77+
# Use --confirm so it won't prompt; adapt flags for your project.
78+
cd website
79+
vercel --token "$VERCEL_TOKEN" --prod --confirm --org "$ORG_ID" --scope "$ORG_ID" --force --local-config ./vercel.json -- --project "$PROJECT_ID"
80+
shell: bash

0 commit comments

Comments
 (0)