From b75ffc9033ad1079204847246e71573dccd5d7a6 Mon Sep 17 00:00:00 2001 From: mkdir700 Date: Fri, 12 Sep 2025 10:49:38 +0800 Subject: [PATCH 1/4] ci(sync): add workflow to sync main to beta (#132) --- .github/workflows/sync-main-to-beta.yml | 37 +++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 .github/workflows/sync-main-to-beta.yml diff --git a/.github/workflows/sync-main-to-beta.yml b/.github/workflows/sync-main-to-beta.yml new file mode 100644 index 00000000..3785b4e6 --- /dev/null +++ b/.github/workflows/sync-main-to-beta.yml @@ -0,0 +1,37 @@ +name: Sync main -> beta + +on: + push: + branches: [main] + +permissions: + contents: write + pull-requests: write + +jobs: + sync: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Create sync branch + run: | + git config user.name "github-actions[bot]" + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + git fetch origin beta + git checkout -b chore/sync-main-to-beta origin/beta + # 线性历史优先:尝试 fast-forward 或 rebase + git merge --ff-only origin/main || git rebase origin/main + git push -u origin chore/sync-main-to-beta + + - name: Open PR main -> beta + uses: peter-evans/create-pull-request@v6 + with: + title: 'chore(sync): main -> beta' + body: 'Auto sync main into beta after a merge to main.' + base: beta + branch: chore/sync-main-to-beta + labels: sync, automated + draft: false From 73af3ab12eb5825001ffce6ce350326f65124603 Mon Sep 17 00:00:00 2001 From: mkdir700 Date: Fri, 12 Sep 2025 10:52:35 +0800 Subject: [PATCH 2/4] ci: add dev release workflow (#131) --- .github/workflows/dev-release.yml | 85 +++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 .github/workflows/dev-release.yml diff --git a/.github/workflows/dev-release.yml b/.github/workflows/dev-release.yml new file mode 100644 index 00000000..ac75ca01 --- /dev/null +++ b/.github/workflows/dev-release.yml @@ -0,0 +1,85 @@ +name: Dev Release + +run-name: '🚀 Dev Release' + +on: + workflow_dispatch: + inputs: + version: + description: 'Version for dev release (optional)' + required: false + default: '' + platform: + description: 'Target platform for dev release' + required: true + default: macos + type: choice + options: + - macos + - linux + - windows + +permissions: + contents: write + pull-requests: read + +jobs: + dev-release: + runs-on: ${{ matrix.os }} + strategy: + matrix: + include: + - platform: macos + os: macos-latest + target: --mac + - platform: linux + os: ubuntu-latest + target: --linux + - platform: windows + os: windows-latest + target: --win + if: matrix.platform == github.event.inputs.platform + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: Setup pnpm + uses: pnpm/action-setup@v3 + with: + version: 8 + + - name: Install dependencies + run: pnpm install + + - name: Set version + if: ${{ github.event.inputs.version != '' }} + run: | + node -e "const fs=require('fs');const pkg=JSON.parse(fs.readFileSync('package.json','utf8'));pkg.version='${{ github.event.inputs.version }}';fs.writeFileSync('package.json', JSON.stringify(pkg, null, 2)+'\n');" + + - name: Build dev package + run: | + pnpm build + pnpm exec electron-builder ${{ matrix.target }} --publish never + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + ELECTRON_BUILDER_CHANNEL: dev + + - name: Upload artifacts + uses: actions/upload-artifact@v4 + with: + name: ${{ matrix.platform }}-dev-artifacts + path: | + dist/*.exe + dist/*.dmg + dist/*.zip + dist/*.AppImage + dist/*.deb + dist/*.yml + dist/*.yaml + dist/*.blockmap + retention-days: 30 From 18debef556ddd5faa66e319df1574c0ada3e1e81 Mon Sep 17 00:00:00 2001 From: mkdir700 Date: Fri, 12 Sep 2025 11:36:58 +0800 Subject: [PATCH 3/4] ci: Update dev-release.yml --- .github/workflows/dev-release.yml | 219 +++++++++++++++++++++++++----- 1 file changed, 185 insertions(+), 34 deletions(-) diff --git a/.github/workflows/dev-release.yml b/.github/workflows/dev-release.yml index ac75ca01..88c35215 100644 --- a/.github/workflows/dev-release.yml +++ b/.github/workflows/dev-release.yml @@ -1,44 +1,26 @@ -name: Dev Release - -run-name: '🚀 Dev Release' +name: Dev Release Build on: workflow_dispatch: inputs: - version: - description: 'Version for dev release (optional)' - required: false - default: '' platform: - description: 'Target platform for dev release' + description: 'Target platform' required: true - default: macos type: choice options: - macos - linux - windows - -permissions: - contents: write - pull-requests: read + version: + description: 'Version to set (optional)' + required: false + type: string jobs: - dev-release: - runs-on: ${{ matrix.os }} - strategy: - matrix: - include: - - platform: macos - os: macos-latest - target: --mac - - platform: linux - os: ubuntu-latest - target: --linux - - platform: windows - os: windows-latest - target: --win - if: matrix.platform == github.event.inputs.platform + build-macos: + runs-on: macos-latest + if: ${{ inputs.platform == 'macos' }} + steps: - name: Checkout repository uses: actions/checkout@v4 @@ -52,34 +34,203 @@ jobs: uses: pnpm/action-setup@v3 with: version: 8 + run_install: false + + - name: Get pnpm store directory + shell: bash + run: echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV + + - name: Setup pnpm cache + uses: actions/cache@v3 + with: + path: ${{ env.STORE_PATH }} + key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-pnpm-store- - name: Install dependencies run: pnpm install - name: Set version - if: ${{ github.event.inputs.version != '' }} + if: ${{ inputs.version != '' }} + shell: bash run: | - node -e "const fs=require('fs');const pkg=JSON.parse(fs.readFileSync('package.json','utf8'));pkg.version='${{ github.event.inputs.version }}';fs.writeFileSync('package.json', JSON.stringify(pkg, null, 2)+'\n');" + node -e " + const fs = require('fs'); + const pkg = JSON.parse(fs.readFileSync('package.json', 'utf8')); + pkg.version = '${{ inputs.version }}'; + fs.writeFileSync('package.json', JSON.stringify(pkg, null, 2) + '\n'); + console.log(\`Version set to \${pkg.version}\`); + " - - name: Build dev package + - name: Build macOS package run: | pnpm build - pnpm exec electron-builder ${{ matrix.target }} --publish never + pnpm exec electron-builder --mac --publish never env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} ELECTRON_BUILDER_CHANNEL: dev + - name: List build artifacts + shell: bash + run: | + echo "Build artifacts:" + find dist -type f -name "*" | head -20 + - name: Upload artifacts uses: actions/upload-artifact@v4 with: - name: ${{ matrix.platform }}-dev-artifacts + name: macos-dev-artifacts path: | - dist/*.exe dist/*.dmg dist/*.zip + dist/*.yml + dist/*.yaml + dist/*.blockmap + retention-days: 30 + if-no-files-found: warn + + build-linux: + runs-on: ubuntu-latest + if: ${{ inputs.platform == 'linux' }} + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: Setup pnpm + uses: pnpm/action-setup@v3 + with: + version: 8 + run_install: false + + - name: Get pnpm store directory + shell: bash + run: echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV + + - name: Setup pnpm cache + uses: actions/cache@v3 + with: + path: ${{ env.STORE_PATH }} + key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-pnpm-store- + + - name: Install dependencies + run: pnpm install + + - name: Set version + if: ${{ inputs.version != '' }} + shell: bash + run: | + node -e " + const fs = require('fs'); + const pkg = JSON.parse(fs.readFileSync('package.json', 'utf8')); + pkg.version = '${{ inputs.version }}'; + fs.writeFileSync('package.json', JSON.stringify(pkg, null, 2) + '\n'); + console.log(\`Version set to \${pkg.version}\`); + " + + - name: Build Linux package + run: | + pnpm build + pnpm exec electron-builder --linux --publish never + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + ELECTRON_BUILDER_CHANNEL: dev + + - name: List build artifacts + shell: bash + run: | + echo "Build artifacts:" + find dist -type f -name "*" | head -20 + + - name: Upload artifacts + uses: actions/upload-artifact@v4 + with: + name: linux-dev-artifacts + path: | dist/*.AppImage dist/*.deb dist/*.yml dist/*.yaml dist/*.blockmap retention-days: 30 + if-no-files-found: warn + + build-windows: + runs-on: windows-latest + if: ${{ inputs.platform == 'windows' }} + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: Setup pnpm + uses: pnpm/action-setup@v3 + with: + version: 8 + run_install: false + + - name: Get pnpm store directory + shell: bash + run: echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV + + - name: Setup pnpm cache + uses: actions/cache@v3 + with: + path: ${{ env.STORE_PATH }} + key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-pnpm-store- + + - name: Install dependencies + run: pnpm install + + - name: Set version + if: ${{ inputs.version != '' }} + shell: bash + run: | + node -e " + const fs = require('fs'); + const pkg = JSON.parse(fs.readFileSync('package.json', 'utf8')); + pkg.version = '${{ inputs.version }}'; + fs.writeFileSync('package.json', JSON.stringify(pkg, null, 2) + '\n'); + console.log(\`Version set to \${pkg.version}\`); + " + + - name: Build Windows package + run: | + pnpm build + pnpm exec electron-builder --win --publish never + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + ELECTRON_BUILDER_CHANNEL: dev + + - name: List build artifacts + shell: bash + run: | + echo "Build artifacts:" + find dist -type f -name "*" | head -20 + + - name: Upload artifacts + uses: actions/upload-artifact@v4 + with: + name: windows-dev-artifacts + path: | + dist/*.exe + dist/*.yml + dist/*.yaml + dist/*.blockmap + retention-days: 30 + if-no-files-found: warn From c6b19be5c15c7d7f7c7d75cb2bd5bbae63e2e101 Mon Sep 17 00:00:00 2001 From: mkdir700 Date: Fri, 12 Sep 2025 12:14:54 +0800 Subject: [PATCH 4/4] Revert "ci(sync): add workflow to sync main to beta (#132)" This reverts commit b75ffc9033ad1079204847246e71573dccd5d7a6. --- .github/workflows/sync-main-to-beta.yml | 37 ------------------------- 1 file changed, 37 deletions(-) delete mode 100644 .github/workflows/sync-main-to-beta.yml diff --git a/.github/workflows/sync-main-to-beta.yml b/.github/workflows/sync-main-to-beta.yml deleted file mode 100644 index 3785b4e6..00000000 --- a/.github/workflows/sync-main-to-beta.yml +++ /dev/null @@ -1,37 +0,0 @@ -name: Sync main -> beta - -on: - push: - branches: [main] - -permissions: - contents: write - pull-requests: write - -jobs: - sync: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Create sync branch - run: | - git config user.name "github-actions[bot]" - git config user.email "41898282+github-actions[bot]@users.noreply.github.com" - git fetch origin beta - git checkout -b chore/sync-main-to-beta origin/beta - # 线性历史优先:尝试 fast-forward 或 rebase - git merge --ff-only origin/main || git rebase origin/main - git push -u origin chore/sync-main-to-beta - - - name: Open PR main -> beta - uses: peter-evans/create-pull-request@v6 - with: - title: 'chore(sync): main -> beta' - body: 'Auto sync main into beta after a merge to main.' - base: beta - branch: chore/sync-main-to-beta - labels: sync, automated - draft: false