49 lines
1.3 KiB
YAML
49 lines
1.3 KiB
YAML
name: Deploy to Vercel
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
push:
|
|
branches: [main]
|
|
paths-ignore:
|
|
- '**.md'
|
|
|
|
jobs:
|
|
deploy:
|
|
name: Deploy to Vercel
|
|
runs-on: easynode-debian
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Cache npm dependencies
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: ~/.npm
|
|
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-npm-
|
|
|
|
- name: Install Vercel CLI
|
|
run: npm install -g vercel
|
|
|
|
- name: Link Vercel Project
|
|
run: |
|
|
mkdir -p .vercel
|
|
echo '{"projectId":"${{ secrets.VERCEL_PROJECT_ID }}","orgId":"${{ secrets.VERCEL_ORG_ID }}"}' > .vercel/project.json
|
|
|
|
- name: Generate version tag
|
|
id: version
|
|
run: |
|
|
DATE=$(date +'%Y.%m.%d')
|
|
TAG="v${DATE}.${{ github.run_number }}"
|
|
echo "tag=${TAG}" >> $GITHUB_OUTPUT
|
|
echo "Generated tag: ${TAG}"
|
|
|
|
- name: Deploy to Vercel
|
|
run: vercel deploy --prod \
|
|
--token=${{ secrets.VERCEL_TOKEN }} \
|
|
--build-env NEXT_PUBLIC_APP_BUILD_VERSION=${{ steps.version.outputs.tag }} \
|
|
--env NEXT_PUBLIC_APP_BUILD_VERSION=${{ steps.version.outputs.tag }} \
|
|
--yes
|