📝 new commercial 【讲点黑话56】棒球老板篮球专家玩转《足球经理》 #17
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy to Vercel | |
on: | |
workflow_dispatch: | |
push: | |
branches: [ master ] | |
pull_request: | |
types: | |
- opened | |
branches: [ master ] | |
env: | |
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} | |
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} | |
jobs: | |
check-if-need-deploy: | |
runs-on: ubuntu-latest | |
outputs: | |
doc-changed: ${{ steps.diff.outputs.DIFF }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.head_ref || github.ref }} | |
fetch-depth: 0 | |
- name: get diff | |
id: diff | |
run: | | |
echo $(git diff --name-only HEAD master -- docs) | |
echo $(git diff --name-only HEAD master -- docs) | wc -w | xargs -I {} echo "DIFF={}" >> "$GITHUB_OUTPUT" | |
echo ${{ steps.diff.outputs.DIFF }} | |
build-and-deploy: | |
runs-on: ubuntu-latest | |
needs: [ check-if-need-deploy ] | |
if: ${{ needs.check-if-need-deploy.outputs.doc-changed != '0' }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: 'vitepress' | |
- uses: actions/setup-node@v4 | |
- name: install deps | |
run: npm install | |
- name: Install Vercel CLI | |
run: npm install --global vercel@latest | |
- name: Determine Deployment Environment | |
id: get-deploy-env | |
run: | | |
if [[ ${{ github.event_name }} == 'pull_request' ]]; then | |
echo "TARGET_ENV=preview" >> $GITHUB_OUTPUT | |
else | |
echo "TARGET_ENV=production" >> $GITHUB_OUTPUT | |
fi | |
- name: Pull Vercel Environment Information | |
run: vercel pull --yes --environment=${{ steps.get-deploy-env.outputs.TARGET_ENV }} --token=${{ secrets.VERCEL_TOKEN }} | |
- name: Build Project Artifacts | |
run: vercel build --target=${{ steps.get-deploy-env.outputs.TARGET_ENV }} --token=${{ secrets.VERCEL_TOKEN }} | |
- name: Deploy Project Artifacts to Vercel | |
run: vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }} --target=${{ steps.get-deploy-env.outputs.TARGET_ENV }} |