diff --git a/.github/cache/action.yml b/.github/cache/action.yml deleted file mode 100644 index f2feb49..0000000 --- a/.github/cache/action.yml +++ /dev/null @@ -1,33 +0,0 @@ -name: Setup PNPM cache - -description: Cache Dependencies -runs: - using: composite - steps: - - uses: pnpm/action-setup@v4 - - - name: Install Node.js - uses: actions/setup-node@v4 - with: - node-version: lts/* - cache: pnpm - - - 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: Enable corepack - # run: corepack enable - - - name: Install dependencies - run: pnpm install - shell: bash diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index efffe36..67eaa8f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,19 +1,78 @@ name: CI -on: [pull_request] +on: + push: + branches: + - main + + pull_request: + branches: + - main concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: - build: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Install pnpm + uses: pnpm/action-setup@v4 + + - name: Set node + uses: actions/setup-node@v4 + with: + node-version: lts/* + + - name: Install + run: pnpm install + + - name: Lint + run: pnpm lint + + typecheck: runs-on: ubuntu-latest steps: - - name: Checkout Repo - uses: actions/checkout@v4 + - uses: actions/checkout@v4 + + - name: Install pnpm + uses: pnpm/action-setup@v4 + + - name: Set node + uses: actions/setup-node@v4 + with: + node-version: lts/* + + - name: Install + run: pnpm install + + - name: Build + run: pnpm build + + - name: Typecheck + run: pnpm typecheck + + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Install pnpm + uses: pnpm/action-setup@v4 + + - name: Set node + uses: actions/setup-node@v4 + with: + node-version: lts/* + + - name: Install + run: pnpm install - - name: Setup Continuous integration - uses: ./.github/cache + - name: Build + run: pnpm build - - run: pnpm run lint && pnpm run build + - name: Test + run: pnpm test diff --git a/.github/workflows/deploy-docs.yml b/.github/workflows/deploy-docs.yml index 49041b1..23e62a0 100644 --- a/.github/workflows/deploy-docs.yml +++ b/.github/workflows/deploy-docs.yml @@ -6,23 +6,30 @@ env: on: push: - branches: - - release + branches: [main] + + workflow_dispatch: -# This is what will cancel the workflow concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: - Deploy-Deployment: + deploy: runs-on: ubuntu-latest steps: - - name: Checkout Repo - uses: actions/checkout@v4 + - uses: actions/checkout@v4 + + - name: Install pnpm + uses: pnpm/action-setup@v4 - - name: Setup Continuous integration - uses: ./.github/cache + - name: Set node + uses: actions/setup-node@v4 + with: + node-version: lts/* + + - name: Install + run: pnpm install - name: Install Vercel CLI run: pnpm install --global vercel@latest @@ -32,28 +39,3 @@ jobs: run: vercel build --prod --token=${{ secrets.VERCEL_TOKEN }} - name: Deploy Project Artifacts to Vercel run: vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }} - - # - name: Notify Discord - # if: failure() - # uses: hunghg255/action-notifications@master - # with: - # discord_webhook: ${{ secrets.CI_CD_DISCORD_URL }} - # title: "Deploy dev failed" - # qrcode: https://dev-web.degenpark.io - # description: "Test here: https://dev-web.degenpark.io" - - # notifification: - # needs: Deploy-Production - # runs-on: ubuntu-latest - # permissions: - # packages: write - # contents: read - - # steps: - # - uses: hunghg255/action-notifications@master - # if: always() - # with: - # discord_webhook: ${{ secrets.CI_CD_DISCORD_URL }} - # title: "Deploy dev successfully" - # qrcode: https://dev-web.degenpark.io - # description: "Test here: https://dev-web.degenpark.io" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9fc15f2..dce15ac 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,18 +14,31 @@ concurrency: jobs: release: + permissions: + id-token: write + contents: write runs-on: ubuntu-latest steps: - - name: Checkout Repo - uses: actions/checkout@v4 + - uses: actions/checkout@v4 + with: + fetch-depth: 0 - - name: Setup Continuous integration - uses: ./.github/cache + - name: Install pnpm + uses: pnpm/action-setup@v4 - - run: pnpm run publish - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + - name: Set node + uses: actions/setup-node@v4 + with: + node-version: lts/* + registry-url: https://registry.npmjs.org/ + + - name: Install + run: pnpm install - - run: pnpm dlx changeloggithub@latest + - run: npx changeloggithub@latest env: GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} + + - run: pnpm run publish + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/docs/package.json b/docs/package.json index cab4d2e..f11620b 100644 --- a/docs/package.json +++ b/docs/package.json @@ -10,7 +10,7 @@ }, "dependencies": { "@shikijs/transformers": "^1.10.3", - "js-utils-es": "^1.0.7", + "js-utils-es": "workspace:*", "prettier": "^3.3.2", "shiki": "^1.10.3" }, diff --git a/package.json b/package.json index e7539ed..cb82bc4 100644 --- a/package.json +++ b/package.json @@ -199,12 +199,13 @@ "format": "prettier --write .", "prepare": "git-scm-hooks", "prepublishOnly": "npm run build", - "release": "bumpp --commit --push --tag && npm publish", + "release": "bumpp --commit --push --tag", "docs:dev": "pnpm run -C ./docs dev", "docs:preview": "pnpm run -C ./docs preview", "docs:build": "pnpm run -C ./docs build", "verify-commit": "verify-commit-msg", - "gen-changelog": "esno ./scripts/genFuncUtils.ts && esno ./scripts/changelog.ts" + "gen-changelog": "esno ./scripts/genFuncUtils.ts && esno ./scripts/changelog.ts", + "typecheck": "tsc --noEmit" }, "devDependencies": { "@antfu/eslint-config": "^2.22.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 8f4a888..7b7382d 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -73,8 +73,8 @@ importers: specifier: ^1.10.3 version: 1.10.3 js-utils-es: - specifier: ^1.0.7 - version: 1.0.7 + specifier: workspace:* + version: link:.. prettier: specifier: ^3.3.2 version: 3.3.3 @@ -2654,9 +2654,6 @@ packages: js-tokens@9.0.0: resolution: {integrity: sha512-WriZw1luRMlmV3LGJaR6QOJjWwgLUTf89OwT2lUOyjX2dJGBwgmIkbcz+7WFZjrZM635JOIR517++e/67CP9dQ==} - js-utils-es@1.0.7: - resolution: {integrity: sha512-9zMeLfNy82KXlIJZV4ONTL42BfYby83CywV7BILlQ05ktkc3LWfxK+W/FqiPsN+pT9rT1OKE/b+z9xMCzMesWw==} - js-yaml@4.1.0: resolution: {integrity: sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==} hasBin: true @@ -7208,8 +7205,6 @@ snapshots: js-tokens@9.0.0: {} - js-utils-es@1.0.7: {} - js-yaml@4.1.0: dependencies: argparse: 2.0.1