update
This commit is contained in:
91
.github/workflows/build.yml
vendored
91
.github/workflows/build.yml
vendored
@@ -6,6 +6,9 @@ on:
|
||||
pull_request:
|
||||
branches: ["main"]
|
||||
|
||||
env:
|
||||
EDGEONE_PROJECT_NAME: cloud-blog
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
@@ -65,7 +68,27 @@ jobs:
|
||||
~/.bun/install/cache
|
||||
key: ${{ runner.os }}-build-${{ hashFiles('**/bun.lock') }}
|
||||
|
||||
deploy:
|
||||
deploy-vercel:
|
||||
needs: build
|
||||
if: ${{ github.event_name == 'push'}}
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- id: commit-hash
|
||||
uses: prompt/actions-commit-hash@v3
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install Vercel CLI
|
||||
run: |
|
||||
bun install -g vercel
|
||||
|
||||
- name: Deploy to Vercel
|
||||
run: |
|
||||
vercel --token ${{ secrets.VERCEL_TOKEN }} --prod --yes
|
||||
|
||||
deploy-edgeone:
|
||||
needs: build
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ github.event_name == 'push' }}
|
||||
@@ -83,17 +106,63 @@ jobs:
|
||||
name: generate-output-${{ steps.commit-hash.outputs.short }}
|
||||
path: dist
|
||||
|
||||
- name: Install Bun
|
||||
uses: oven-sh/setup-bun@v2
|
||||
|
||||
- name: Prepare deployment
|
||||
- name: Install EdgeOne CLI
|
||||
run: |
|
||||
bun install -g edgeone vercel wrangler
|
||||
bun install -g edgeone || true
|
||||
|
||||
- name: Deploy to Vercel
|
||||
- name: Deploy to EdgeOne
|
||||
run: |
|
||||
vercel --token ${{ secrets.VERCEL_TOKEN }} --prod --yes
|
||||
if [ -z "${{ secrets.EDGEONE_TOKEN }}" ] || [ -z "${{ env.EDGEONE_PROJECT_NAME }}" ]; then
|
||||
echo "Skipping EdgeOne deploy: missing EDGEONE_TOKEN or EDGEONE_PROJECT_NAME" && exit 0
|
||||
fi
|
||||
edgeone pages deploy ./dist --token ${{ secrets.EDGEONE_TOKEN }} --name "${{ env.EDGEONE_PROJECT_NAME }}" || true
|
||||
|
||||
- name: Deploy to Edgeone
|
||||
run: |
|
||||
edgeone pages deploy ./dist --token ${{ secrets.EDGEONE_TOKEN }} --name ${{ env.EDGEONE_PROJECT_NAME }}
|
||||
# deploy-cloudflare:
|
||||
# needs: build
|
||||
# runs-on: ubuntu-latest
|
||||
# if: ${{ github.event_name == 'push' && secrets.CLOUDFLARE_API_TOKEN != '' && secrets.CLOUDFLARE_ACCOUNT_ID != '' && secrets.CLOUDFLARE_PROJECT_NAME != '' }}
|
||||
|
||||
# steps:
|
||||
# - id: commit-hash
|
||||
# uses: prompt/actions-commit-hash@v3
|
||||
|
||||
# - name: Checkout
|
||||
# uses: actions/checkout@v4
|
||||
|
||||
# - name: Download generate artifact
|
||||
# uses: actions/download-artifact@v4
|
||||
# with:
|
||||
# name: generate-output-${{ steps.commit-hash.outputs.short }}
|
||||
# path: dist
|
||||
|
||||
# - name: Deploy to Cloudflare Pages
|
||||
# uses: cloudflare/pages-action@v1
|
||||
# with:
|
||||
# apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
||||
# accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
||||
# projectName: ${{ secrets.CLOUDFLARE_PROJECT_NAME }}
|
||||
# directory: dist
|
||||
|
||||
# deploy-aliyun:
|
||||
# needs: build
|
||||
# runs-on: ubuntu-latest
|
||||
# if: ${{ github.event_name == 'push' && secrets.ALIYUN_ESA_DEPLOY_URL != '' && secrets.ALIYUN_ESA_TOKEN != '' }}
|
||||
|
||||
# steps:
|
||||
# - id: commit-hash
|
||||
# uses: prompt/actions-commit-hash@v3
|
||||
|
||||
# - name: Checkout
|
||||
# uses: actions/checkout@v4
|
||||
|
||||
# - name: Download generate artifact
|
||||
# uses: actions/download-artifact@v4
|
||||
# with:
|
||||
# name: generate-output-${{ steps.commit-hash.outputs.short }}
|
||||
# path: dist
|
||||
|
||||
# - name: Package and Deploy to Aliyun ESA
|
||||
# run: |
|
||||
# cd dist || exit 1
|
||||
# zip -r ../dist-deploy.zip .
|
||||
# curl -v -X POST -H "Authorization: Bearer ${{ secrets.ALIYUN_ESA_TOKEN }}" -F "file=@../dist-deploy.zip" ${{ secrets.ALIYUN_ESA_DEPLOY_URL }}
|
||||
|
||||
Reference in New Issue
Block a user