From 2441695034bd56d34d842ecc097c7665d92fae6d Mon Sep 17 00:00:00 2001 From: NullVoxPopuli <199018+NullVoxPopuli@users.noreply.github.com> Date: Fri, 22 Sep 2023 17:54:00 -0400 Subject: [PATCH] Setup ci --- .github/actions/pnpm/action.yml | 23 ++++++++++++++ .github/workflows/ci.yml | 28 +++++++++++++++++ .github/workflows/docs.yml | 56 --------------------------------- 3 files changed, 51 insertions(+), 56 deletions(-) create mode 100644 .github/actions/pnpm/action.yml create mode 100644 .github/workflows/ci.yml delete mode 100644 .github/workflows/docs.yml diff --git a/.github/actions/pnpm/action.yml b/.github/actions/pnpm/action.yml new file mode 100644 index 0000000..4b97e71 --- /dev/null +++ b/.github/actions/pnpm/action.yml @@ -0,0 +1,23 @@ +name: Setup node, pnpm, and cache +description: Setup node and install dependencies using pnpm +runs: + using: "composite" + steps: + - uses: volta-cli/action@v1 + # minimum supported Node + with: + node-version: 18.x + - name: Cache pnpm modules + uses: actions/cache@v3 + with: + path: | + ~/.pnpm-store + 'node_modules/' + 'node_modules/.cache' + key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-pnpm- + - uses: pnpm/action-setup@v2.2.2 + with: + version: 7.17.1 + run_install: true diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..1606e70 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,28 @@ +name: CI +on: + pull_request: + push: + branches: [main] + +jobs: + install_dependencies: + name: Install Dependencies + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - uses: volta-cli/action@v1 + - uses: ./.github/actions/pnpm + + + docs_build: + name: "Build Docs" + runs-on: ubuntu-latest + needs: [install_dependencies] + + steps: + - uses: actions/checkout@v3 + - uses: ./.github/actions/pnpm + - run: pnpm docs:build + + diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml deleted file mode 100644 index 96406a5..0000000 --- a/.github/workflows/docs.yml +++ /dev/null @@ -1,56 +0,0 @@ -name: docs - -on: - # trigger deployment on every push to main branch - push: - branches: [main] - # trigger deployment manually - workflow_dispatch: - -jobs: - docs: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - with: - # fetch all commits to get last updated time or other git log info - fetch-depth: 0 - - - name: Setup Node.js - uses: actions/setup-node@v1 - with: - # choose node.js version to use - node-version: "14" - - # cache node_modules - - name: Cache dependencies - uses: actions/cache@v2 - id: yarn-cache - with: - path: | - **/node_modules - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- - # install dependencies if the cache did not hit - - name: Install dependencies - if: steps.yarn-cache.outputs.cache-hit != 'true' - run: yarn --frozen-lockfile - - # run build script - - name: Build VuePress site - run: yarn docs:build - - # please check out the docs of the workflow for more details - # @see https://github.com/crazy-max/ghaction-github-pages - - name: Deploy to GitHub Pages - uses: crazy-max/ghaction-github-pages@v2 - with: - # deploy to gh-pages branch - target_branch: gh-pages - # deploy the default output dir of VuePress - build_dir: docs/.vuepress/dist - env: - # @see https://docs.github.com/en/actions/reference/authentication-in-a-workflow#about-the-github_token-secret - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}