Skip to content

Commit 10c5f8c

Browse files
fix: replace amondnet/vercel-action with direct Vercel CLI steps
Root cause: YAML >- block scalar joins lines with a space, so multi-word values like 'Freelance DevOps & Cloud Engineering' passed as --build-env flags were word-split by the shell — 'DevOps' became a bare token that Vercel CLI treated as a file/directory path. Fix: drop amondnet/vercel-action + vercel-args entirely. Use direct 'run:' steps with the official Vercel CLI instead: 1. Install vercel@latest globally 2. Write .env.production via heredoc (no shell-splitting — values with spaces, ampersands, etc. are safe) 3. vercel pull --yes --environment=production (creates .vercel/ dir) 4. vercel env add RESEND_API_KEY production --force (server-only secret) 5. vercel build --prod (local build, reads .env.production) 6. vercel deploy --prebuilt --prod (upload artefact, no remote re-build) .env.production is covered by '.env.*' in .gitignore so it is never accidentally committed.
1 parent 14ce831 commit 10c5f8c

File tree

1 file changed

+57
-27
lines changed

1 file changed

+57
-27
lines changed

.github/workflows/ci.yml

Lines changed: 57 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -58,37 +58,67 @@ jobs:
5858
name: Deploy to Vercel (Production)
5959
needs: build
6060
runs-on: ubuntu-latest
61-
# Only deploy on push to main, not on pull requests
6261
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
6362

63+
env:
64+
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
65+
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
66+
6467
steps:
6568
- name: Checkout repository
6669
uses: actions/checkout@v4
6770

68-
- name: Deploy to Vercel
69-
uses: amondnet/vercel-action@v25
71+
- name: Set up Node.js
72+
uses: actions/setup-node@v4
7073
with:
71-
vercel-token: ${{ secrets.VERCEL_TOKEN }}
72-
vercel-org-id: ${{ secrets.VERCEL_ORG_ID }}
73-
vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID }}
74-
working-directory: ./
75-
vercel-args: >-
76-
--prod
77-
--build-env NEXT_PUBLIC_SITE_NAME="RelientOps"
78-
--build-env NEXT_PUBLIC_SITE_TAGLINE="Freelance DevOps & Cloud Engineering"
79-
--build-env NEXT_PUBLIC_SITE_DESCRIPTION="I design, build, and operate cloud-native infrastructure. From Kubernetes to CI/CD pipelines, I help startups ship faster and stay reliable."
80-
--build-env NEXT_PUBLIC_SITE_URL="https://relientops.io"
81-
--build-env NEXT_PUBLIC_SITE_OG_IMAGE="/images/og-default.png"
82-
--build-env NEXT_PUBLIC_CONTACT_EMAIL="sagardeepak2002@gmail.com"
83-
--build-env NEXT_PUBLIC_SOCIAL_GITHUB="https://github.com/sagarDeepakDevOps"
84-
--build-env NEXT_PUBLIC_SOCIAL_LINKEDIN="https://linkedin.com/in/sagardeepak2002"
85-
--build-env NEXT_PUBLIC_OWNER_NAME="Deepak Sagar"
86-
--build-env NEXT_PUBLIC_OWNER_TITLE="Freelance DevOps & Cloud Engineer"
87-
--build-env NEXT_PUBLIC_OWNER_EXPERIENCE="3+"
88-
--build-env NEXT_PUBLIC_OWNER_EXPERIENCE_LABEL="Hands-On Cloud & Automation Experience"
89-
--build-env NEXT_PUBLIC_OWNER_BIO="I work directly with founders and engineering teams to design, automate, and stabilize cloud environments across AWS and Azure."
90-
--build-env NEXT_PUBLIC_OWNER_LINKEDIN="https://linkedin.com/in/sagardeepak2002"
91-
--build-env NEXT_PUBLIC_FREE_REVIEW_HREF="/free-review"
92-
--build-env NEXT_PUBLIC_FREE_REVIEW_DURATION="30 min"
93-
--build-env NEXT_PUBLIC_CALENDLY_URL="https://calendly.com/sagardeepak2002/30min"
94-
--env RESEND_API_KEY="${{ secrets.RESEND_API_KEY }}"
74+
node-version: "20"
75+
cache: "npm"
76+
77+
- name: Install dependencies
78+
run: npm ci
79+
80+
- name: Install Vercel CLI
81+
run: npm install --global vercel@latest
82+
83+
# Write all NEXT_PUBLIC_ vars into .env.production so `vercel build`
84+
# picks them up automatically — no shell-quoting issues with spaces.
85+
- name: Write .env.production
86+
run: |
87+
cat > .env.production <<'ENVEOF'
88+
NEXT_PUBLIC_SITE_NAME=RelientOps
89+
NEXT_PUBLIC_SITE_TAGLINE=Freelance DevOps & Cloud Engineering
90+
NEXT_PUBLIC_SITE_DESCRIPTION=I design, build, and operate cloud-native infrastructure. From Kubernetes to CI/CD pipelines, I help startups ship faster and stay reliable.
91+
NEXT_PUBLIC_SITE_URL=https://relientops.io
92+
NEXT_PUBLIC_SITE_OG_IMAGE=/images/og-default.png
93+
NEXT_PUBLIC_CONTACT_EMAIL=sagardeepak2002@gmail.com
94+
NEXT_PUBLIC_SOCIAL_GITHUB=https://github.com/sagarDeepakDevOps
95+
NEXT_PUBLIC_SOCIAL_LINKEDIN=https://linkedin.com/in/sagardeepak2002
96+
NEXT_PUBLIC_OWNER_NAME=Deepak Sagar
97+
NEXT_PUBLIC_OWNER_TITLE=Freelance DevOps & Cloud Engineer
98+
NEXT_PUBLIC_OWNER_EXPERIENCE=3+
99+
NEXT_PUBLIC_OWNER_EXPERIENCE_LABEL=Hands-On Cloud & Automation Experience
100+
NEXT_PUBLIC_OWNER_BIO=I work directly with founders and engineering teams to design, automate, and stabilize cloud environments across AWS and Azure.
101+
NEXT_PUBLIC_OWNER_LINKEDIN=https://linkedin.com/in/sagardeepak2002
102+
NEXT_PUBLIC_FREE_REVIEW_HREF=/free-review
103+
NEXT_PUBLIC_FREE_REVIEW_DURATION=30 min
104+
NEXT_PUBLIC_CALENDLY_URL=https://calendly.com/sagardeepak2002/30min
105+
ENVEOF
106+
107+
# Pull project metadata (creates .vercel/ directory)
108+
- name: Pull Vercel project settings
109+
run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }}
110+
111+
# Add the server-only secret to the Vercel project (idempotent)
112+
- name: Set RESEND_API_KEY on Vercel
113+
run: |
114+
echo "${{ secrets.RESEND_API_KEY }}" \
115+
| vercel env add RESEND_API_KEY production \
116+
--token=${{ secrets.VERCEL_TOKEN }} --force
117+
118+
# Build locally using Vercel's build pipeline (honours .env.production)
119+
- name: Build
120+
run: vercel build --prod --token=${{ secrets.VERCEL_TOKEN }}
121+
122+
# Upload the pre-built output — no re-build on Vercel's side
123+
- name: Deploy prebuilt output
124+
run: vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }}

0 commit comments

Comments
 (0)