From 48d4f8a86bae42db37514d24980fbcb4c6082bac Mon Sep 17 00:00:00 2001 From: sealday Date: Fri, 19 Apr 2024 18:31:26 +0800 Subject: [PATCH] feat: support cached --- .gitea/workflows/{on_pr.yaml => pr.yaml} | 13 +++++----- .gitea/workflows/release.yaml | 30 +++++++----------------- 2 files changed, 15 insertions(+), 28 deletions(-) rename .gitea/workflows/{on_pr.yaml => pr.yaml} (54%) diff --git a/.gitea/workflows/on_pr.yaml b/.gitea/workflows/pr.yaml similarity index 54% rename from .gitea/workflows/on_pr.yaml rename to .gitea/workflows/pr.yaml index 79ee18056..bf1cb654c 100644 --- a/.gitea/workflows/on_pr.yaml +++ b/.gitea/workflows/pr.yaml @@ -10,17 +10,16 @@ permissions: jobs: CI: runs-on: ubuntu-latest - container: node:20 steps: - name: Checkout code uses: actions/checkout@v3 - - name: config registry - run: npm config set registry https://npm.daoyoucloud.com/ - - name: install pnpm - uses: pnpm/action-setup@v3 + - name: Install Node.js + uses: actions/setup-node@v4 with: - standalone: true - - name: Install dependencies + node-version: 20 + registry-url: ${{ vars.REGISTRY_URL }} + cache: 'pnpm' + - name: Install deps run: pnpm install - name: Build run: pnpm build:p diff --git a/.gitea/workflows/release.yaml b/.gitea/workflows/release.yaml index 3276e82ba..e485358c7 100644 --- a/.gitea/workflows/release.yaml +++ b/.gitea/workflows/release.yaml @@ -10,32 +10,20 @@ permissions: jobs: CI: runs-on: ubuntu-latest - container: node:20 steps: - name: Checkout code uses: actions/checkout@v3 - - name: config registry - run: npm config set registry https://npm.daoyoucloud.com/ - - name: install pnpm - uses: pnpm/action-setup@v3 + - name: Install Node.js + uses: actions/setup-node@v4 with: - standalone: true - - name: Get pnpm store directory - shell: bash - run: | - echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV - - name: Setup pnpm cache - uses: actions/cache@v4 - with: - path: ${{ env.STORE_PATH }} - key: pnpm-store - - name: Install dependencies + node-version: 20 + registry-url: ${{ vars.REGISTRY_URL }} + cache: 'pnpm' + - name: Install deps run: pnpm install - name: Build run: pnpm build:p - - name: show status - run: git status - - name: publish - run: pnpm publish -r --registry=https://npm.daoyoucloud.com --publish-branch ${{ gitea.ref }} + - name: Publish env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + NODE_AUTH_TOKEN: ${{ secrets.NPMTOKEN }} + run: pnpm -r publish --access=public --no-git-checks --publish-branch ${{ gitea.ref }}