From efe7ea561e7b1ee4cfeef4205d11779c8b10e975 Mon Sep 17 00:00:00 2001 From: TeddyHuang-00 Date: Wed, 14 Feb 2024 14:47:27 -0500 Subject: [PATCH] ci: :construction_worker: Add github actions for testing and deployment --- .github/workflows/deploy-docs.yml | 58 +++++++++++++++++++++++++++++++ .github/workflows/test.yml | 27 ++++++++++++++ 2 files changed, 85 insertions(+) create mode 100644 .github/workflows/deploy-docs.yml create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/deploy-docs.yml b/.github/workflows/deploy-docs.yml new file mode 100644 index 0000000..b3243fa --- /dev/null +++ b/.github/workflows/deploy-docs.yml @@ -0,0 +1,58 @@ +name: 部署文档 + +permissions: + contents: write + pages: write + id-token: write + actions: read + +on: + push: + branches: + - main + workflow_dispatch: + +concurrency: + group: "pages" + cancel-in-progress: true + +jobs: + build: + runs-on: ubuntu-latest + env: + NUXT_APP_BASE_URL: /StrangeAttractors/ + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: 安装 Bun + uses: oven-sh/setup-bun@v1 + + - name: 安装依赖 + run: bun install --frozen-lockfile + + - name: 构建文档 + env: + NODE_OPTIONS: --max_old_space_size=8192 + run: bun generate + + - name: 设置 Pages + uses: actions/configure-pages@v4 + + - name: 上传文件 + uses: actions/upload-pages-artifact@v3 + with: + path: "./dist" + + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + needs: build + steps: + - name: 部署 GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..a986b81 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,27 @@ +name: 测试 + +on: + push: + workflow_dispatch: + +jobs: + build-n-deploy: + runs-on: ubuntu-latest + env: + NUXT_APP_BASE_URL: /StrangeAttractors/ + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: 安装 Bun + uses: oven-sh/setup-bun@v1 + + - name: 安装依赖 + run: bun install --frozen-lockfile + + - name: 构建网页 + env: + NODE_OPTIONS: --max_old_space_size=8192 + run: bun generate