From fb6d2b89acdbfd49de4d5b9d0fce10c839f7ded4 Mon Sep 17 00:00:00 2001 From: tiye Date: Sat, 21 Nov 2026 17:09:20 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=B9=E9=BD=90=E6=AD=A3=E5=BC=8F=E4=BE=9D?= =?UTF-8?q?=E8=B5=96=E5=B9=B6=E8=BF=81=E7=A7=BB=E5=89=8D=E7=AB=AF=E8=B5=84?= =?UTF-8?q?=E6=BA=90=E8=87=B3=20COS?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/upload.yaml | 31 ++++++++++++++++++++++++++++--- deps.cirru | 4 ++-- package.json | 2 +- 3 files changed, 31 insertions(+), 6 deletions(-) diff --git a/.github/workflows/upload.yaml b/.github/workflows/upload.yaml index ebe9228..bbf02fe 100644 --- a/.github/workflows/upload.yaml +++ b/.github/workflows/upload.yaml @@ -11,8 +11,8 @@ jobs: test: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 + - uses: actions/checkout@v7.0.1 + - uses: actions/setup-node@v6.5.0 with: node-version: 22 - uses: calcit-lang/setup-calcit@v1.5.1 @@ -24,7 +24,8 @@ jobs: set -euo pipefail corepack enable yarn install --immutable - caps --ci + caps --strict --ci + caps verify --toolchain - name: Validate Calcit run: | set -euo pipefail @@ -32,8 +33,32 @@ jobs: git diff --exit-code -- calcit.cirru calcit calcit.cirru --check-only calcit calcit.cirru fix --workflow strict --verify + - name: Select CDN path + id: assets + env: + PR_NUMBER: ${{ github.event.pull_request.number }} + run: | + prefix="${GITHUB_REPOSITORY}/" + if [[ "$GITHUB_EVENT_NAME" == "pull_request" ]]; then + prefix="${GITHUB_REPOSITORY}/pr/${PR_NUMBER}/${GITHUB_RUN_ID}/${GITHUB_RUN_ATTEMPT}/" + fi + base_url="https://cos-sh.tiye.me/${prefix}" + echo "VITE_BASE_URL=$base_url" >> "$GITHUB_ENV" + echo "prefix=$prefix" >> "$GITHUB_OUTPUT" + echo "base-url=$base_url" >> "$GITHUB_OUTPUT" - name: Build run: yarn build + - name: Upload and verify frontend assets + if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository + uses: worktools/cos-upload-action@v1.3.0 + with: + source-dir: dist + bucket: ${{ secrets.COS_BUCKET }} + region: ap-shanghai + prefix: ${{ steps.assets.outputs.prefix }} + public-base-url: ${{ steps.assets.outputs.base-url }} + secret-id: ${{ secrets.COS_SECRET_ID }} + secret-key: ${{ secrets.COS_SECRET_KEY }} - name: Deploy to server if: github.event_name == 'push' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main') id: deploy diff --git a/deps.cirru b/deps.cirru index 839a63b..b3faa8a 100644 --- a/deps.cirru +++ b/deps.cirru @@ -1,4 +1,4 @@ {} (:calcit-version |0.44.0) :version |0.0.1 - :dependencies $ {} (|Respo/respo.calcit |0.19.12) - |Respo/respo-ui.calcit |0.15.6 + :dependencies $ {} (|Respo/respo.calcit |0.19.13) + |Respo/respo-ui.calcit |0.15.7 diff --git a/package.json b/package.json index a702db4..01161dd 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "description": "ClojureScript workflow using Calcit Editor", "main": "index.js", "scripts": { - "build": "calcit calcit.cirru js && vite build --base=./", + "build": "calcit calcit.cirru js && vite build --base=${VITE_BASE_URL:-./}", "watch": "calcit calcit.cirru -w" }, "repository": {