From 49d62400e8cc5b12202affd0cbc74f522e46629a Mon Sep 17 00:00:00 2001 From: Dustin Do Date: Sun, 9 Jun 2024 05:04:27 +0700 Subject: [PATCH] feat(api): [CI] add CI action (#53) --- .github/workflows/api_build.yaml | 45 ++++++++++++++++++++++++++++++++ package.json | 2 ++ 2 files changed, 47 insertions(+) create mode 100644 .github/workflows/api_build.yaml diff --git a/.github/workflows/api_build.yaml b/.github/workflows/api_build.yaml new file mode 100644 index 00000000..8449368a --- /dev/null +++ b/.github/workflows/api_build.yaml @@ -0,0 +1,45 @@ +name: Build API + +on: + - push + - pull_request + - workflow_dispatch + +jobs: + build_api: + name: Build API + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install Node.js + uses: actions/setup-node@v4 + with: + node-version: 18 + + - uses: pnpm/action-setup@v4 + name: Install pnpm + with: + version: 8 + run_install: false + + - name: Get pnpm store directory + shell: bash + run: | + echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV + + - uses: actions/cache@v4 + name: Setup pnpm cache + with: + path: ${{ env.STORE_PATH }} + key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-pnpm-store- + + - name: Install dependencies + run: pnpm install + + - name: Build + run: pnpm api:build diff --git a/package.json b/package.json index c9358992..84b25a28 100644 --- a/package.json +++ b/package.json @@ -4,6 +4,8 @@ "license": "GPL-3.0", "workspaces": ["apps/*", "packages/*"], "scripts": { + "api:dev": "pnpm --filter @6pm/api run dev", + "api:build": "pnpm --filter @6pm/api run build", "api:start": "pnpm --filter @6pm/api run start" }, "devDependencies": {