Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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}}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- configuration: ${{ inputs.configuration}}
- configuration: ${{ inputs.configuration }}

architecture: x64
- configuration: Beta
- configuration: ${{ inputs.configuration}}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- configuration: ${{ inputs.configuration}}
- configuration: ${{ inputs.configuration }}

architecture: ARM64
fail-fast: false

Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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 }}
102 changes: 0 additions & 102 deletions .github/workflows/release-stable_publish.yml

This file was deleted.

55 changes: 55 additions & 0 deletions .github/workflows/release-trigger.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Release Trigger

permissions:
contents: read

on:
pull_request:
types: [closed]

jobs:
trigger_release:
if: ${{ github.event.pull_request.merged == true }}
Comment thread
sourcery-ai[bot] marked this conversation as resolved.
permissions:
actions: write
contents: write
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 }}
Loading