Skip to content

Commit

Permalink
fix: 修复github actions问题 (#13)
Browse files Browse the repository at this point in the history
* fix: 修复github actions问题

* feat: 增加pr workflow
  • Loading branch information
Saltro authored Aug 1, 2024
1 parent d97011b commit 5283117
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 12 deletions.
33 changes: 21 additions & 12 deletions .github/workflows/cicd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,53 +6,62 @@ 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/[email protected]
with:
accessKeyId: ${{ secrets.ALI_KEY_ID }}
accessKeySecret: ${{ secrets.ALI_KEY_SECRET }}
type: Directory
path: https://cas.ziqiang.net.cn/


48 changes: 48 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 5283117

Please sign in to comment.