diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml index 3937605..ea8d921 100644 --- a/.github/workflows/cicd.yml +++ b/.github/workflows/cicd.yml @@ -6,48 +6,57 @@ on: workflow_dispatch: jobs: - build-and-deploy: + lint: runs-on: ubuntu-latest - steps: - uses: actions/checkout@v4 with: fetch-depth: 0 - - name: Install pnpm uses: pnpm/action-setup@v4 with: version: 9.5.0 run_install: false - - name: Use Node.js 22 uses: actions/setup-node@v4 with: node-version: '22' cache: 'pnpm' - - name: Install dependencies run: pnpm install - - name: Code lint run: pnpm lint - + build-and-deploy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Install pnpm + uses: pnpm/action-setup@v4 + with: + version: 9.5.0 + run_install: false + - name: Use Node.js 22 + uses: actions/setup-node@v4 + with: + node-version: '22' + cache: 'pnpm' + - name: Install dependencies + run: pnpm install - name: Build (Generate static files) run: pnpm generate - - name: Setup aliyun OSS - uses: yizhoumo/setup-ossutil@v3 + uses: yizhoumo/setup-ossutil@v2 with: endpoint: oss-cn-hangzhou.aliyuncs.com access-key-id: ${{ secrets.ALI_KEY_ID }} access-key-secret: ${{ secrets.ALI_KEY_SECRET }} - - name: Upload files to OSS run: | ossutil rm -f oss://zq-auth-v2/ -r --exclude "*.txt" ossutil cp -rf dist oss://zq-auth-v2/ ossutil set-meta oss://zq-auth-v2/ Cache-Control:no-cache --include "*.html" -r - - name: Refresh CDN uses: visionwx/ali-cdn-refresh@v0.1.1 with: @@ -55,4 +64,4 @@ jobs: accessKeySecret: ${{ secrets.ALI_KEY_SECRET }} type: Directory path: https://cas.ziqiang.net.cn/ - + \ No newline at end of file diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml new file mode 100644 index 0000000..21f4657 --- /dev/null +++ b/.github/workflows/pr.yml @@ -0,0 +1,48 @@ +# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions + +name: PR CI + +on: pull_request + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Install pnpm + uses: pnpm/action-setup@v4 + with: + version: 9.5.0 + run_install: false + - name: Use Node.js 22 + uses: actions/setup-node@v4 + with: + node-version: 22.x + cache: 'pnpm' + - name: Install dependencies + run: pnpm install + - name: Code lint + run: pnpm lint + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Install pnpm + uses: pnpm/action-setup@v4 + with: + version: 9.5.0 + run_install: false + - name: Use Node.js 22 + uses: actions/setup-node@v4 + with: + node-version: 22.x + cache: 'pnpm' + - name: Install dependencies + run: pnpm install + - name: Build (Generate static files) + run: pnpm generate