From 9f18bb50856c90f32f57d340ae1938a94e4d9058 Mon Sep 17 00:00:00 2001 From: tangge233 Date: Sat, 18 Apr 2026 23:02:49 +0800 Subject: [PATCH 1/6] feat(ci): Immutable release --- ...e-beta_publish.yml => release-publish.yml} | 71 ++++++++---- .github/workflows/release-stable_publish.yml | 102 ------------------ .github/workflows/release-trigger.yml | 52 +++++++++ 3 files changed, 103 insertions(+), 122 deletions(-) rename .github/workflows/{release-beta_publish.yml => release-publish.yml} (58%) delete mode 100644 .github/workflows/release-stable_publish.yml create mode 100644 .github/workflows/release-trigger.yml diff --git a/.github/workflows/release-beta_publish.yml b/.github/workflows/release-publish.yml similarity index 58% rename from .github/workflows/release-beta_publish.yml rename to .github/workflows/release-publish.yml index 3537e35fd..349387d44 100644 --- a/.github/workflows/release-beta_publish.yml +++ b/.github/workflows/release-publish.yml @@ -1,21 +1,34 @@ -name: Publish (Beta) +name: Release Beta (Actual) permissions: - contents: read + contents: write + actions: write on: - release: - types: [published] + workflow_dispatch: + inputs: + configuration: + description: 'Configuration to build (e.g., Release)' + required: true + type: string + version: + description: 'Version to release (e.g., 2.14.2)' + required: true + type: string + prerelease: + description: 'Is this a prerelease?' + required: false + type: boolean + default: true jobs: build: - if: ${{ github.event.release.prerelease }} strategy: matrix: include: - - configuration: Beta + - configuration: ${{ inputs.configuration}} architecture: x64 - - configuration: Beta + - configuration: ${{ inputs.configuration}} architecture: ARM64 fail-fast: false @@ -26,11 +39,8 @@ jobs: secrets: inherit changelog: - permissions: - contents: write runs-on: ubuntu-latest continue-on-error: true - if: ${{ github.event.release.prerelease }} steps: - name: Checkout all uses: actions/checkout@v4 @@ -43,26 +53,26 @@ jobs: - name: Generate changelog run: git-cliff --latest -o CHANGELOG.md - - name: Add changelog to release - uses: softprops/action-gh-release@v2.5.0 + - name: Create or update release + uses: softprops/action-gh-release@v3.0.0 with: - tag_name: ${{ github.event.release.tag_name }} + draft: true + tag_name: v${{ inputs.version }} + name: Release ${{ inputs.version }} body_path: CHANGELOG.md + prerelease: ${{ inputs.prerelease }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} rename_and_release: - permissions: - contents: write - actions: write needs: [build, changelog] runs-on: ubuntu-latest strategy: matrix: include: - - configuration: Beta + - configuration: ${{ inputs.configuration }} architecture: x64 - - configuration: Beta + - configuration: ${{ inputs.configuration }} architecture: ARM64 steps: - name: Download Build Artifact @@ -86,8 +96,10 @@ jobs: gpg --detach-sign --armor "PCL2_CE_${{ matrix.configuration }}_${{ matrix.architecture }}.exe" - name: Upload binary and signature to Release - uses: softprops/action-gh-release@v2.2.2 + uses: softprops/action-gh-release@v3.0.0 with: + draft: true + tag_name: v${{ inputs.version }} files: | PCL2_CE_${{ matrix.configuration }}_${{ matrix.architecture }}.exe PCL2_CE_${{ matrix.configuration }}_${{ matrix.architecture }}.exe.asc @@ -96,7 +108,26 @@ jobs: - name: Trigger MirrorChyanUploading run: | - gh workflow run --repo $GITHUB_REPOSITORY mirrorchyan_uploading.yml -f channel=beta -f arch=${{ matrix.architecture == 'x64' && 'x64' || 'arm64' }} + MRC_CHANNEL = "stable" + if [ "${{ inputs.configuration }}" = "Beta" ]; then + MRC_CHANNEL = "beta" + fi + + gh workflow run --repo $GITHUB_REPOSITORY mirrorchyan_uploading.yml -f channel=$MRC_CHANNEL -f arch=${{ matrix.architecture == 'x64' && 'x64' || 'arm64' }} + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + publish_draft: + needs: [rename_and_release] + runs-on: ubuntu-latest + steps: + - name: Publish Draft + uses: softprops/action-gh-release@v3.0.0 + with: + tag_name: v${{ inputs.version }} + + - name: Trigger MirrorChyanUploading + run: | gh workflow run --repo $GITHUB_REPOSITORY mirrorchyan_release_note.yml env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release-stable_publish.yml b/.github/workflows/release-stable_publish.yml deleted file mode 100644 index 80ccb2df7..000000000 --- a/.github/workflows/release-stable_publish.yml +++ /dev/null @@ -1,102 +0,0 @@ -name: Publish (Release) - -permissions: - contents: read - -on: - release: - types: [published] - -jobs: - build: - if: ${{ !github.event.release.prerelease }} - strategy: - matrix: - include: - - configuration: Release - architecture: x64 - - configuration: Release - architecture: ARM64 - fail-fast: false - - uses: ./.github/workflows/reusable-build.yml - with: - configuration: ${{ matrix.configuration }} - architecture: ${{ matrix.architecture }} - secrets: inherit - - changelog: - permissions: - contents: write - runs-on: ubuntu-latest - continue-on-error: true - if: ${{ !github.event.release.prerelease }} - steps: - - name: Checkout all - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Install git-cliff - uses: taiki-e/install-action@git-cliff - - - name: Generate changelog - run: git-cliff --latest -o CHANGELOG.md - - - name: Add changelog to release - uses: softprops/action-gh-release@v2.2.2 - with: - tag_name: ${{ github.event.release.tag_name }} - body_path: CHANGELOG.md - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - rename_and_release: - permissions: - contents: write - actions: write - needs: [build, changelog] - runs-on: ubuntu-latest - strategy: - matrix: - include: - - configuration: Release - architecture: x64 - - configuration: Release - architecture: ARM64 - steps: - - name: Download Build Artifact - uses: actions/download-artifact@v4 - with: - name: PCL2_CE_${{ matrix.configuration }}_${{ matrix.architecture }} - path: ./artifact - - - name: Rename binaries - run: | - mv "./artifact/Plain Craft Launcher 2.exe" "PCL2_CE_${{ matrix.configuration }}_${{ matrix.architecture }}.exe" - - - name: Import GPG key - uses: crazy-max/ghaction-import-gpg@v6 - with: - gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} - passphrase: ${{ secrets.GPG_PASSPHRASE }} - - - name: Sign the binary - run: | - gpg --detach-sign --armor "PCL2_CE_${{ matrix.configuration }}_${{ matrix.architecture }}.exe" - - - name: Upload binary and signature to Release - uses: softprops/action-gh-release@v2.5.0 - with: - files: | - PCL2_CE_${{ matrix.configuration }}_${{ matrix.architecture }}.exe - PCL2_CE_${{ matrix.configuration }}_${{ matrix.architecture }}.exe.asc - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Trigger MirrorChyanUploading - run: | - gh workflow run --repo $GITHUB_REPOSITORY mirrorchyan_uploading.yml -f channel=stable -f arch=${{ matrix.architecture == 'x64' && 'x64' || 'arm64' }} - gh workflow run --repo $GITHUB_REPOSITORY mirrorchyan_release_note.yml - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release-trigger.yml b/.github/workflows/release-trigger.yml new file mode 100644 index 000000000..1bd9a4ec8 --- /dev/null +++ b/.github/workflows/release-trigger.yml @@ -0,0 +1,52 @@ +name: Release Trigger + +permissions: + contents: read + +on: + pull_request: + types: [closed] + +jobs: + trigger_release: + if: ${{ github.event.pull_request.merged == true }} + runs-on: ubuntu-latest + steps: + - name: Extract version from PR title + id: extract + run: | + PR_TITLE="${{ github.event.pull_request.title }}" + echo "PR Title: $PR_TITLE" + + # 尝试匹配 "release-stable: VERSION" 或 "beta-release: VERSION" 格式,支持 SemVer(可选 v 前缀) + if [[ "$PR_TITLE" =~ (release-stable|beta-release):\ ?[vV]?([0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.]+)?(\+[a-zA-Z0-9.]+)?) ]]; then + VERSION="${BASH_REMATCH[2]}" + RELEASE_TYPE="${BASH_REMATCH[1]}" + + if [[ "$RELEASE_TYPE" == "beta-release" ]]; then + IS_BETA="true" + else + IS_BETA="false" + fi + + echo "version=$VERSION" >> $GITHUB_OUTPUT + echo "is_beta=$IS_BETA" >> $GITHUB_OUTPUT + echo "Extracted version: $VERSION, is_beta: $IS_BETA" + else + echo "Error: PR title does not match expected format 'release-stable: VERSION' or 'beta-release: VERSION' (SemVer)" + exit 1 + fi + + - name: Trigger Release Workflow + run: | + CONFIGURATION="Release" + if [[ "${{ steps.extract.outputs.is_beta }}" == "true" ]]; then + CONFIGURATION="Beta" + fi + + gh workflow run release-publish.yml \ + -f version=${{ steps.extract.outputs.version }} \ + -f configuration="${CONFIGURATION}" \ + -f prerelease=${{ steps.extract.outputs.is_beta }} + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} From bf2550d7a1430c332e3d49bfc7b0403f622de1e4 Mon Sep 17 00:00:00 2001 From: tangge233 Date: Sat, 18 Apr 2026 23:08:55 +0800 Subject: [PATCH 2/6] chore: apply suggestions --- .github/workflows/release-publish.yml | 4 ++-- .github/workflows/release-trigger.yml | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release-publish.yml b/.github/workflows/release-publish.yml index 349387d44..4f3581713 100644 --- a/.github/workflows/release-publish.yml +++ b/.github/workflows/release-publish.yml @@ -108,9 +108,9 @@ jobs: - name: Trigger MirrorChyanUploading run: | - MRC_CHANNEL = "stable" + MRC_CHANNEL="stable" if [ "${{ inputs.configuration }}" = "Beta" ]; then - MRC_CHANNEL = "beta" + MRC_CHANNEL="beta" fi gh workflow run --repo $GITHUB_REPOSITORY mirrorchyan_uploading.yml -f channel=$MRC_CHANNEL -f arch=${{ matrix.architecture == 'x64' && 'x64' || 'arm64' }} diff --git a/.github/workflows/release-trigger.yml b/.github/workflows/release-trigger.yml index 1bd9a4ec8..42463c557 100644 --- a/.github/workflows/release-trigger.yml +++ b/.github/workflows/release-trigger.yml @@ -10,6 +10,9 @@ on: jobs: trigger_release: if: ${{ github.event.pull_request.merged == true }} + permissions: + actions: write + contents: write runs-on: ubuntu-latest steps: - name: Extract version from PR title From 93e445675b5add49d0ad973bed08ff215b8c499e Mon Sep 17 00:00:00 2001 From: tangge233 Date: Mon, 20 Apr 2026 21:36:42 +0800 Subject: [PATCH 3/6] chore: typo --- .github/workflows/release-trigger.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release-trigger.yml b/.github/workflows/release-trigger.yml index 42463c557..0439bc384 100644 --- a/.github/workflows/release-trigger.yml +++ b/.github/workflows/release-trigger.yml @@ -21,12 +21,12 @@ jobs: PR_TITLE="${{ github.event.pull_request.title }}" echo "PR Title: $PR_TITLE" - # 尝试匹配 "release-stable: VERSION" 或 "beta-release: VERSION" 格式,支持 SemVer(可选 v 前缀) - if [[ "$PR_TITLE" =~ (release-stable|beta-release):\ ?[vV]?([0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.]+)?(\+[a-zA-Z0-9.]+)?) ]]; then + # 尝试匹配 "release-stable: VERSION" 或 "release-beta: VERSION" 格式,支持 SemVer(可选 v 前缀) + if [[ "$PR_TITLE" =~ (release-stable|release-beta):\ ?[vV]?([0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.]+)?(\+[a-zA-Z0-9.]+)?) ]]; then VERSION="${BASH_REMATCH[2]}" RELEASE_TYPE="${BASH_REMATCH[1]}" - if [[ "$RELEASE_TYPE" == "beta-release" ]]; then + if [[ "$RELEASE_TYPE" == "release-beta" ]]; then IS_BETA="true" else IS_BETA="false" @@ -36,7 +36,7 @@ jobs: echo "is_beta=$IS_BETA" >> $GITHUB_OUTPUT echo "Extracted version: $VERSION, is_beta: $IS_BETA" else - echo "Error: PR title does not match expected format 'release-stable: VERSION' or 'beta-release: VERSION' (SemVer)" + echo "Error: PR title does not match expected format 'release-stable: VERSION' or 'release-beta: VERSION' (SemVer)" exit 1 fi From 85e46ae8f9fa50ba9d6eb4c1160b2bc6299ad644 Mon Sep 17 00:00:00 2001 From: SaltWood_233 <105980161+SALTWOOD@users.noreply.github.com> Date: Tue, 28 Apr 2026 23:21:40 +0900 Subject: [PATCH 4/6] ci: support building C# and VB project variants Add project_file and artifact_name_suffix inputs to the reusable workflow, allowing the build matrix to compile both .csproj and .vbproj targets. Artifact names now include a suffix to distinguish between language variants. --- .github/workflows/build-test.yml | 14 ++++++++++++++ .github/workflows/reusable-build.yml | 12 ++++++++++-- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index 7bbce95e6..99fccce00 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -27,12 +27,26 @@ jobs: include: - configuration: CI architecture: x64 + project_file: Plain Craft Launcher 2/Plain Craft Launcher 2.csproj + artifact_name_suffix: _CSharp - configuration: CI architecture: ARM64 + project_file: Plain Craft Launcher 2/Plain Craft Launcher 2.csproj + artifact_name_suffix: _CSharp + - configuration: CI + architecture: x64 + project_file: Plain Craft Launcher 2/Plain Craft Launcher 2.vbproj + artifact_name_suffix: _VB + - configuration: CI + architecture: ARM64 + project_file: Plain Craft Launcher 2/Plain Craft Launcher 2.vbproj + artifact_name_suffix: _VB fail-fast: false uses: ./.github/workflows/reusable-build.yml with: configuration: ${{ matrix.configuration }} architecture: ${{ matrix.architecture }} + project_file: ${{ matrix.project_file }} + artifact_name_suffix: ${{ matrix.artifact_name_suffix }} secrets: inherit diff --git a/.github/workflows/reusable-build.yml b/.github/workflows/reusable-build.yml index f08cf1a52..ae4d9831c 100644 --- a/.github/workflows/reusable-build.yml +++ b/.github/workflows/reusable-build.yml @@ -12,6 +12,14 @@ on: architecture: required: true type: string + project_file: + required: false + type: string + default: Plain Craft Launcher 2/Plain Craft Launcher 2.csproj + artifact_name_suffix: + required: false + type: string + default: "" jobs: build: @@ -59,12 +67,12 @@ jobs: PCL_LOBBY_DEFAULT_SECRET: ${{ secrets.LOBBY_DEFAULT_SECRET }} PCL_GITHUB_SHA: ${{ github.sha }} run: | - dotnet publish "Plain Craft Launcher 2/Plain Craft Launcher 2.vbproj" \ + dotnet publish "${{ inputs.project_file }}" \ -p:Configuration=${{ inputs.configuration }} -p:Platform=${{ inputs.architecture }} \ -p:DeleteExistingFiles=true -o ./artifact --no-self-contained - name: Upload the Build Artifact uses: actions/upload-artifact@v4 with: - name: PCL2_CE_${{ inputs.configuration }}_${{ inputs.architecture }} + name: PCL2_CE_${{ inputs.configuration }}_${{ inputs.architecture }}${{ inputs.artifact_name_suffix }} path: artifact/** From 94529e87b7677cb42b63b059221b0610802f67db Mon Sep 17 00:00:00 2001 From: SaltWood_233 <105980161+SALTWOOD@users.noreply.github.com> Date: Tue, 28 Apr 2026 23:27:02 +0900 Subject: [PATCH 5/6] Revert "ci: support building C# and VB project variants" This reverts commit 85e46ae8f9fa50ba9d6eb4c1160b2bc6299ad644. --- .github/workflows/build-test.yml | 14 -------------- .github/workflows/reusable-build.yml | 12 ++---------- 2 files changed, 2 insertions(+), 24 deletions(-) diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index 99fccce00..7bbce95e6 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -27,26 +27,12 @@ jobs: include: - configuration: CI architecture: x64 - project_file: Plain Craft Launcher 2/Plain Craft Launcher 2.csproj - artifact_name_suffix: _CSharp - configuration: CI architecture: ARM64 - project_file: Plain Craft Launcher 2/Plain Craft Launcher 2.csproj - artifact_name_suffix: _CSharp - - configuration: CI - architecture: x64 - project_file: Plain Craft Launcher 2/Plain Craft Launcher 2.vbproj - artifact_name_suffix: _VB - - configuration: CI - architecture: ARM64 - project_file: Plain Craft Launcher 2/Plain Craft Launcher 2.vbproj - artifact_name_suffix: _VB fail-fast: false uses: ./.github/workflows/reusable-build.yml with: configuration: ${{ matrix.configuration }} architecture: ${{ matrix.architecture }} - project_file: ${{ matrix.project_file }} - artifact_name_suffix: ${{ matrix.artifact_name_suffix }} secrets: inherit diff --git a/.github/workflows/reusable-build.yml b/.github/workflows/reusable-build.yml index ae4d9831c..f08cf1a52 100644 --- a/.github/workflows/reusable-build.yml +++ b/.github/workflows/reusable-build.yml @@ -12,14 +12,6 @@ on: architecture: required: true type: string - project_file: - required: false - type: string - default: Plain Craft Launcher 2/Plain Craft Launcher 2.csproj - artifact_name_suffix: - required: false - type: string - default: "" jobs: build: @@ -67,12 +59,12 @@ jobs: PCL_LOBBY_DEFAULT_SECRET: ${{ secrets.LOBBY_DEFAULT_SECRET }} PCL_GITHUB_SHA: ${{ github.sha }} run: | - dotnet publish "${{ inputs.project_file }}" \ + dotnet publish "Plain Craft Launcher 2/Plain Craft Launcher 2.vbproj" \ -p:Configuration=${{ inputs.configuration }} -p:Platform=${{ inputs.architecture }} \ -p:DeleteExistingFiles=true -o ./artifact --no-self-contained - name: Upload the Build Artifact uses: actions/upload-artifact@v4 with: - name: PCL2_CE_${{ inputs.configuration }}_${{ inputs.architecture }}${{ inputs.artifact_name_suffix }} + name: PCL2_CE_${{ inputs.configuration }}_${{ inputs.architecture }} path: artifact/** From 430424f6a48a4bb6c37564bb3f7201a131b293a5 Mon Sep 17 00:00:00 2001 From: wyc-26 Date: Thu, 30 Apr 2026 18:21:15 +0800 Subject: [PATCH 6/6] chore: add blank space --- .github/workflows/release-publish.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release-publish.yml b/.github/workflows/release-publish.yml index 4f3581713..8efdbbabe 100644 --- a/.github/workflows/release-publish.yml +++ b/.github/workflows/release-publish.yml @@ -26,9 +26,9 @@ jobs: strategy: matrix: include: - - configuration: ${{ inputs.configuration}} + - configuration: ${{ inputs.configuration }} architecture: x64 - - configuration: ${{ inputs.configuration}} + - configuration: ${{ inputs.configuration }} architecture: ARM64 fail-fast: false