Skip to content

deploy-preview

deploy-preview #33

name: Vercel Deploy Preview
on:
workflow_dispatch:
repository_dispatch:
types: [deploy-preview]
jobs:
deploy:
runs-on: ubuntu-latest
environment: preview
steps:
- uses: actions/checkout@v4
with:
repository: LR-Tech-Blog/content
path: content
- uses: actions/checkout@v4
with:
repository: LR-Tech-Blog/blog
path: blog
- name: Remove dumy post images
run: rm -rf ./blog/public/images/posts
- name: Remove dumy content
run: rm -rf ./blog/src/content
- name: Copy content
run:
|
mkdir ./blog/src/content
mv ./content/content/* ./blog/src/content/
- name: Copy post images
run:
|
mkdir ./blog/public/images/posts
mv ./content/public/images/posts/* ./blog/public/images/posts/
- name: Install Vercel CLI
run: npm install -g vercel
- name: Install dependencies
run:
|
cd ./blog
npm install
- name: Astro build
run:
|
cd ./blog
npx astro sync
npx astro build
- name: Pull env information
run:
|
cd ./blog
vercel pull --yes --environment ${{ vars.VERCEL_ENVIRONMENT }} --token ${{ secrets.VERCEL_TOKEN }}
- name: Vercel build
run:
|
cd ./blog
vercel build --yes --token=${{ secrets.VERCEL_TOKEN }}
- name: Vercel Deploy
run:
|
cd ./blog
vercel deploy --prebuilt --yes --token=${{ secrets.VERCEL_TOKEN }} > ./url.txt
- name: Get Deploy URL
run: echo "::notice name=URL::$(cat ./blog/url.txt)"