Merge branch 'dev' into dev

This commit is contained in:
cc
2026-04-03 19:52:35 +08:00
committed by GitHub

View File

@@ -11,6 +11,7 @@ permissions:
env: env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true" FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"
FIXED_PREVIEW_TAG: nightly-preview
ELECTRON_BUILDER_BINARIES_MIRROR: https://github.com/electron-userland/electron-builder-binaries/releases/download/ ELECTRON_BUILDER_BINARIES_MIRROR: https://github.com/electron-userland/electron-builder-binaries/releases/download/
jobs: jobs:
@@ -33,8 +34,6 @@ jobs:
- name: Decide whether to build and generate preview version - name: Decide whether to build and generate preview version
id: meta id: meta
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash shell: bash
run: | run: |
set -euo pipefail set -euo pipefail
@@ -52,14 +51,24 @@ jobs:
BASE_VERSION="$(node -p "require('./package.json').version.split('-')[0]")" BASE_VERSION="$(node -p "require('./package.json').version.split('-')[0]")"
YEAR_2="$(TZ=Asia/Shanghai date +%y)" YEAR_2="$(TZ=Asia/Shanghai date +%y)"
EXISTING_COUNT="$(gh api --paginate "repos/${GITHUB_REPOSITORY}/releases" --jq "[.[].tag_name | select(test(\"^v${BASE_VERSION}-preview[.]${YEAR_2}[.][0-9]+$\"))] | length")" PREVIEW_VERSION="${BASE_VERSION}-preview.${YEAR_2}.${GITHUB_RUN_NUMBER}"
NEXT_COUNT=$((EXISTING_COUNT + 1))
PREVIEW_VERSION="${BASE_VERSION}-preview.${YEAR_2}.${NEXT_COUNT}"
echo "should_build=$SHOULD_BUILD" >> "$GITHUB_OUTPUT" echo "should_build=$SHOULD_BUILD" >> "$GITHUB_OUTPUT"
echo "preview_version=$PREVIEW_VERSION" >> "$GITHUB_OUTPUT" echo "preview_version=$PREVIEW_VERSION" >> "$GITHUB_OUTPUT"
echo "Preview version: $PREVIEW_VERSION (commits in last 24h on main: $COMMITS_24H)" echo "Preview version: $PREVIEW_VERSION (commits in last 24h on main: $COMMITS_24H)"
- name: Ensure fixed preview prerelease exists
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
run: |
set -euo pipefail
if gh release view "$FIXED_PREVIEW_TAG" --repo "$GITHUB_REPOSITORY" >/dev/null 2>&1; then
gh release edit "$FIXED_PREVIEW_TAG" --repo "$GITHUB_REPOSITORY" --title "Preview Nightly Build" --prerelease
else
gh release create "$FIXED_PREVIEW_TAG" --repo "$GITHUB_REPOSITORY" --title "Preview Nightly Build" --notes "预览版发布页" --prerelease
fi
preview-mac-arm64: preview-mac-arm64:
needs: prepare needs: prepare
if: needs.prepare.outputs.should_build == 'true' if: needs.prepare.outputs.should_build == 'true'
@@ -88,15 +97,29 @@ jobs:
npx tsc npx tsc
npx vite build npx vite build
- name: Package and Publish macOS arm64 preview - name: Package macOS arm64 preview artifacts
env: env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CSC_IDENTITY_AUTO_DISCOVERY: "false" CSC_IDENTITY_AUTO_DISCOVERY: "false"
shell: bash shell: bash
run: | run: |
export ELECTRON_BUILDER_BINARIES_MIRROR="https://github.com/electron-userland/electron-builder-binaries/releases/download/" export ELECTRON_BUILDER_BINARIES_MIRROR="https://github.com/electron-userland/electron-builder-binaries/releases/download/"
echo "Using ELECTRON_BUILDER_BINARIES_MIRROR=$ELECTRON_BUILDER_BINARIES_MIRROR" echo "Using ELECTRON_BUILDER_BINARIES_MIRROR=$ELECTRON_BUILDER_BINARIES_MIRROR"
npx electron-builder --mac dmg --arm64 --publish always '--config.publish.releaseType=prerelease' '--config.publish.channel=preview' npx electron-builder --mac dmg --arm64 --publish never '--config.publish.channel=preview' '--config.artifactName=${productName}-preview-arm64.${ext}'
- name: Upload macOS arm64 assets to fixed preview release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
run: |
assets=()
while IFS= read -r file; do
assets+=("$file")
done < <(find release -maxdepth 1 -type f | sort)
if [ "${#assets[@]}" -eq 0 ]; then
echo "No release files found in ./release"
exit 1
fi
gh release upload "$FIXED_PREVIEW_TAG" "${assets[@]}" --repo "$GITHUB_REPOSITORY" --clobber
preview-linux: preview-linux:
needs: prepare needs: prepare
@@ -126,11 +149,27 @@ jobs:
npx tsc npx tsc
npx vite build npx vite build
- name: Package and Publish Linux preview - name: Package Linux preview artifacts
env: env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
run: | run: |
npx electron-builder --linux --publish always '--config.publish.releaseType=prerelease' '--config.publish.channel=preview' npx electron-builder --linux --publish never '--config.publish.channel=preview' '--config.artifactName=${productName}-preview-linux.${ext}'
- name: Upload Linux assets to fixed preview release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
run: |
assets=()
while IFS= read -r file; do
assets+=("$file")
done < <(find release -maxdepth 1 -type f | sort)
if [ "${#assets[@]}" -eq 0 ]; then
echo "No release files found in ./release"
exit 1
fi
gh release upload "$FIXED_PREVIEW_TAG" "${assets[@]}" --repo "$GITHUB_REPOSITORY" --clobber
preview-win-x64: preview-win-x64:
needs: prepare needs: prepare
@@ -160,11 +199,27 @@ jobs:
npx tsc npx tsc
npx vite build npx vite build
- name: Package and Publish Windows x64 preview - name: Package Windows x64 preview artifacts
env: env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
run: | run: |
npx electron-builder --win nsis --x64 --publish always '--config.publish.releaseType=prerelease' '--config.publish.channel=preview' '--config.artifactName=${productName}-${version}-x64-Setup.${ext}' npx electron-builder --win nsis --x64 --publish never '--config.publish.channel=preview' '--config.artifactName=${productName}-preview-x64-Setup.${ext}'
- name: Upload Windows x64 assets to fixed preview release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
run: |
assets=()
while IFS= read -r file; do
assets+=("$file")
done < <(find release -maxdepth 1 -type f | sort)
if [ "${#assets[@]}" -eq 0 ]; then
echo "No release files found in ./release"
exit 1
fi
gh release upload "$FIXED_PREVIEW_TAG" "${assets[@]}" --repo "$GITHUB_REPOSITORY" --clobber
preview-win-arm64: preview-win-arm64:
needs: prepare needs: prepare
@@ -194,11 +249,27 @@ jobs:
npx tsc npx tsc
npx vite build npx vite build
- name: Package and Publish Windows arm64 preview - name: Package Windows arm64 preview artifacts
env: env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
run: | run: |
npx electron-builder --win nsis --arm64 --publish always '--config.publish.releaseType=prerelease' '--config.publish.channel=preview-arm64' '--config.artifactName=${productName}-${version}-arm64-Setup.${ext}' npx electron-builder --win nsis --arm64 --publish never '--config.publish.channel=preview-arm64' '--config.artifactName=${productName}-preview-arm64-Setup.${ext}'
- name: Upload Windows arm64 assets to fixed preview release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
run: |
assets=()
while IFS= read -r file; do
assets+=("$file")
done < <(find release -maxdepth 1 -type f | sort)
if [ "${#assets[@]}" -eq 0 ]; then
echo "No release files found in ./release"
exit 1
fi
gh release upload "$FIXED_PREVIEW_TAG" "${assets[@]}" --repo "$GITHUB_REPOSITORY" --clobber
update-preview-release-notes: update-preview-release-notes:
needs: needs:
@@ -217,7 +288,8 @@ jobs:
run: | run: |
set -euo pipefail set -euo pipefail
TAG="v${{ needs.prepare.outputs.preview_version }}" TAG="$FIXED_PREVIEW_TAG"
CURRENT_PREVIEW_VERSION="${{ needs.prepare.outputs.preview_version }}"
REPO="$GITHUB_REPOSITORY" REPO="$GITHUB_REPOSITORY"
RELEASE_PAGE="https://github.com/$REPO/releases/tag/$TAG" RELEASE_PAGE="https://github.com/$REPO/releases/tag/$TAG"
@@ -259,6 +331,7 @@ jobs:
## Preview Nightly 说明 ## Preview Nightly 说明
- 该版本为 **预览版**,用于提前体验即将发布的功能与修复。 - 该版本为 **预览版**,用于提前体验即将发布的功能与修复。
- 可能包含尚未完全稳定的改动,不建议长期使用 - 可能包含尚未完全稳定的改动,不建议长期使用
- 当前版本号:\`$CURRENT_PREVIEW_VERSION\`
## 下载 ## 下载
- Windows x64: ${WINDOWS_URL:-$RELEASE_PAGE} - Windows x64: ${WINDOWS_URL:-$RELEASE_PAGE}