Skip to content

Commit

Permalink
fix: 添加deploy.yaml (#57)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lansongxx authored Feb 16, 2024
1 parent edeb10f commit 2965136
Showing 1 changed file with 54 additions and 0 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: CI/CD Pipeline
on:
push:
branches: ["master"]
tags: ["v*.*.*"]
pull_request:
branches: ["master"]

jobs:
build-and-upload:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2
with:
ref: ${{ github.ref }}

- name: Set up Node.js
uses: actions/setup-node@v1
with:
node-version: '20'

- name: Install dependencies
run: yarn install

- name: Build
run: yarn build

- name: Configure COSCMD
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
env:
COS_SECRET_ID: ${{ secrets.COS_SECRET_ID }}
COS_SECRET_KEY: ${{ secrets.COS_SECRET_KEY }}
COS_BUCKET_NAME: ${{ secrets.COS_BUCKET_NAME }}
COS_BUCKET_REGION: ${{ secrets.COS_BUCKET_REGION }}
run: |
pip install coscmd
coscmd config -a $COS_SECRET_ID -s $COS_SECRET_KEY -b $COS_BUCKET_NAME -r $COS_BUCKET_REGION
- name: Upload to COS Bucket
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
env:
COS_UPLOAD_FROM_PATH: ${{ secrets.COS_UPLOAD_FROM_PATH }}
run: coscmd upload -r $COS_UPLOAD_FROM_PATH /

- name: Invalidate CDN cache
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
env:
TENCENT_CLOUD_SECRET_ID: ${{ secrets.TENCENT_CLOUD_SECRET_ID }}
TENCENT_CLOUD_SECRET_KEY: ${{ secrets.TENCENT_CLOUD_SECRET_KEY }}
run: |
pip install tccli
tccli cdn PurgePathCache --cli-unfold-argument --Paths 'https://cloudmind.top/' --FlushType flush

0 comments on commit 2965136

Please sign in to comment.