CICD 部署到 laf.run #41
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
# 使用 node v18 启用 corepack pnpm,pnpm run build | |
name: Node.js CI | |
on: | |
# 手动触发 | |
workflow_dispatch: | |
# push: | |
# branches: [main] | |
# pull_request: | |
# branches: [main] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [18.x] | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: pnpm/action-setup@v2 | |
with: | |
version: 8.8.0 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: "pnpm" | |
# registry-url: "https://registry.npmjs.org" | |
- name: Install dependencies | |
run: pnpm install | |
- name: Build | |
run: pnpm run generate | |
env: | |
NUXT_PUBLIC_STUDIO_TOKENS: ${{ secrets.NUXT_PUBLIC_STUDIO_TOKENS }} | |
# - name: Test | |
# run: pnpm test | |
- name: Upload to Tencent COS 腾讯云对象存储 | |
uses: TencentCloud/cos-action@master | |
with: | |
secret_id: ${{ secrets.TENCENT_CLOUD_SECRET_ID }} | |
secret_key: ${{ secrets.TENCENT_CLOUD_SECRET_KEY }} | |
cos_bucket: ${{ secrets.COS_BUCKET }} | |
cos_region: ${{ secrets.COS_REGION }} | |
# accelerate: true # 可选,如果你懂。前提需要你手动开启全球加速 | |
local_path: dist/public | |
remote_path: / | |
clean: true | |
# - name: Upload to Aliyun OSS 阿里云对象存储 不知道为啥有个 404 先不启用 | |
# uses: jakejarvis/s3-sync-action@master | |
# with: | |
# args: --acl public-read --follow-symlinks --delete | |
# env: | |
# AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }} | |
# AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
# AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
# AWS_REGION: "oss-cn-beijing" # optional: defaults to us-east-1 | |
# AWS_S3_ENDPOINT: "https://${{ secrets.AWS_S3_BUCKET }}.oss-cn-beijing.aliyuncs.com" | |
# SOURCE_DIR: "dist" | |
# DEST_DIR: "/" |