Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: deploy to vercel #38

Merged
merged 5 commits into from
Jan 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 41 additions & 1 deletion .github/workflows/template.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build template
name: Build template and deploy to vercel
on: push

jobs:
Expand Down Expand Up @@ -30,3 +30,43 @@ jobs:
run: yarn build
- name: Lint
run: yarn lint

vercel_deploy:
name: Deploy template
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
repository: jojomatik/nuxt-3-base
ref: build/nuxt-bundle
- uses: actions/setup-node@v4
with:
node-version: '18'
- name: Install Vercel CLI
run: npm install --global vercel@latest
- name: Cache node modules
uses: actions/cache@v3
id: cache
env:
cache-name: cache-node-modules
with:
path: node_modules
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('yarn.lock') }}
- name: Install dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: yarn install --frozen-lockfile
- name: Install correct version of nuxt-bundle
run: yarn add ${{ github.repository }}#${{ github.ref }}
- name: Pull Vercel Environment Information
run: vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }}
- name: Build Project Artifacts
run: vercel build --token=${{ secrets.VERCEL_TOKEN }}
env:
NITRO_PRESET: vercel-edge
- name: Deploy Project Artifacts to Vercel (Preview)
if: github.ref != 'refs/heads/main'
run: vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }}
- name: Deploy Project Artifacts to Vercel (Prod)
if: github.ref == 'refs/heads/main'
run: vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }}