summaryrefslogtreecommitdiff
path: root/.github/workflows
diff options
context:
space:
mode:
Diffstat (limited to '.github/workflows')
-rw-r--r--.github/workflows/ci.yaml99
-rw-r--r--.github/workflows/deploy.yaml34
-rw-r--r--.github/workflows/lint.yml44
3 files changed, 133 insertions, 44 deletions
diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml
new file mode 100644
index 0000000..1d57123
--- /dev/null
+++ b/.github/workflows/ci.yaml
@@ -0,0 +1,99 @@
+name: CI
+
+on:
+ pull_request:
+ workflow_dispatch:
+ workflow_call:
+
+jobs:
+ build:
+ needs: [lint, format]
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v4
+ with:
+ submodules: recursive
+
+ - name: setup pnpm
+ uses: pnpm/action-setup@v2
+
+ - name: setup node
+ uses: actions/setup-node@v4
+ with:
+ node-version: 20
+ cache: pnpm
+ cache-dependency-path: pnpm-lock.yaml
+
+ - name: install deps
+ run: pnpm install --frozen-lockfile
+
+ - name: run build
+ run: pnpm build
+
+ - name: upload ./dist
+ uses: actions/upload-artifact@v3
+ with:
+ name: dist
+ path: dist
+
+ lint:
+ runs-on: ubuntu-latest
+
+ permissions:
+ security-events: write
+
+ steps:
+ - uses: actions/checkout@v4
+ with:
+ submodules: recursive
+
+ - name: setup pnpm
+ uses: pnpm/action-setup@v2
+
+ - name: setup node
+ uses: actions/setup-node@v4
+ with:
+ node-version: 20
+ cache: pnpm
+ cache-dependency-path: pnpm-lock.yaml
+
+ - name: install deps
+ run: pnpm install --frozen-lockfile
+
+ - name: run lint
+ run: pnpm run lint -f @microsoft/eslint-formatter-sarif -o /tmp/lint.sarif
+ continue-on-error: true
+
+ - name: strip suppressed results
+ run: pnpm dlx @ryanccn/sarif-strip-suppressed /tmp/lint.sarif
+
+ - name: upload results
+ uses: github/codeql-action/upload-sarif@v2
+ with:
+ sarif_file: /tmp/lint.sarif
+ wait-for-processing: true
+
+ format:
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v4
+ with:
+ submodules: recursive
+
+ - name: setup pnpm
+ uses: pnpm/action-setup@v2
+
+ - name: setup node
+ uses: actions/setup-node@v4
+ with:
+ node-version: 20
+ cache: pnpm
+ cache-dependency-path: pnpm-lock.yaml
+
+ - name: install deps
+ run: pnpm install --frozen-lockfile
+
+ - name: run prettier
+ run: pnpm exec prettier --check .
diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml
new file mode 100644
index 0000000..23ba2c8
--- /dev/null
+++ b/.github/workflows/deploy.yaml
@@ -0,0 +1,34 @@
+name: deploy
+
+on:
+ push:
+ workflow_dispatch:
+
+jobs:
+ ci:
+ uses: ./.github/workflows/ci.yaml
+ permissions:
+ security-events: write
+
+ deploy:
+ needs: ci
+ runs-on: ubuntu-latest
+
+ permissions:
+ deployments: write
+
+ steps:
+ - name: download dist
+ uses: actions/download-artifact@v3
+ with:
+ name: dist
+ path: dist
+
+ - name: deploy to cloudflare pages
+ uses: cloudflare/pages-action@v1
+ with:
+ apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
+ accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
+ projectName: teawieapi
+ directory: dist
+ gitHubToken: ${{ github.token }}
diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
deleted file mode 100644
index 63db8df..0000000
--- a/.github/workflows/lint.yml
+++ /dev/null
@@ -1,44 +0,0 @@
-name: Lint
-
-on:
- push:
- branches: [main]
- pull_request:
- workflow_dispatch:
-
-jobs:
- lint:
- runs-on: ubuntu-latest
-
- permissions:
- contents: read
- security-events: write
-
- steps:
- - uses: actions/checkout@v4
-
- - name: Setup pnpm
- uses: pnpm/action-setup@v2
-
- - name: Setup Node.js
- uses: actions/setup-node@v4
- with:
- node-version: 20
- cache: pnpm
- cache-dependency-path: pnpm-lock.yaml
-
- - name: Install dependencies
- run: pnpm install --frozen-lockfile
-
- - name: Lint
- run: pnpm run lint -f @microsoft/eslint-formatter-sarif -o /tmp/lint.sarif
- continue-on-error: true
-
- - name: Strip suppressed results
- run: pnpm dlx @ryanccn/sarif-strip-suppressed /tmp/lint.sarif
-
- - name: Upload results
- uses: github/codeql-action/upload-sarif@v2
- with:
- sarif_file: /tmp/lint.sarif
- wait-for-processing: true