From 7f062b198a35ed5a44284d2833df02fc38eaefcd Mon Sep 17 00:00:00 2001 From: Northword <44738481+northword@users.noreply.github.com> Date: Mon, 30 Dec 2024 22:36:39 +0800 Subject: [PATCH] ci: group dependabot prs and run lint&build for every push&pr (#233) * ci: group all non-major deps for dependabot closes: #222 * ci: run lint and build on every push * ci: upload xpi to artifact * ci: fix lint:check script * ci: fix dist path --- .github/dependabot.yml | 5 +++ .github/workflows/ci.yml | 65 +++++++++++++++++++++++++++++++++++ .github/workflows/release.yml | 2 +- package.json | 3 +- 4 files changed, 73 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/ci.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 3a3cce5..3dcce0c 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -9,3 +9,8 @@ updates: directory: "/" # Location of package manifests schedule: interval: "weekly" + groups: + all-non-major: + update-types: + - "minor" + - "patch" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..2d93df8 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,65 @@ +name: CI + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + lint: + runs-on: ubuntu-latest + env: + GITHUB_TOKEN: ${{ secrets.GitHub_TOKEN }} + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 20 + cache: npm + + - name: Install deps + run: | + npm install + + - name: Run Lint + run: | + npm run lint:check + + build: + runs-on: ubuntu-latest + env: + GITHUB_TOKEN: ${{ secrets.GitHub_TOKEN }} + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 20 + cache: npm + + - name: Install deps + run: | + npm install + + - name: Run Build + run: | + npm run build + + - name: Upload build result + uses: actions/upload-artifact@v4 + with: + name: build-result + path: | + build diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2e9b4eb..1e5f066 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -27,7 +27,7 @@ jobs: node-version: 20 - name: Install deps - run: npm install -f + run: npm install - name: Build run: | diff --git a/package.json b/package.json index 96780b8..e1a3b59 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,8 @@ "scripts": { "start": "zotero-plugin serve", "build": "tsc --noEmit && zotero-plugin build", - "lint": "prettier --write . && eslint . --fix", + "lint:check": "prettier --check . && eslint .", + "lint:fix": "prettier --write . && eslint . --fix", "release": "zotero-plugin release", "test": "echo \"Error: no test specified\" && exit 1", "update-deps": "npm update --save"