diff --git a/.github/workflows/develop-synced-dispatch.yml b/.github/workflows/develop-synced-dispatch.yml new file mode 100644 index 0000000000..d22ff96e5a --- /dev/null +++ b/.github/workflows/develop-synced-dispatch.yml @@ -0,0 +1,50 @@ +name: Dispatch develop-synced after sync/main merged (Scheme A) + +on: + pull_request: + types: + - closed + branches: + - develop + +jobs: + dispatch_develop_synced: + if: github.event.pull_request.merged == true && startsWith(github.event.pull_request.head.ref, 'sync/main-') + + runs-on: ubuntu-latest + + permissions: + contents: write + + steps: + - name: Derive version from sync branch + id: version + run: | + set -euo pipefail + BRANCH="${{ github.event.pull_request.head.ref }}" + echo "Head branch: ${BRANCH}" + VERSION="${BRANCH#sync/main-}" + if [ -z "${VERSION}" ] || [ "${VERSION}" = "${BRANCH}" ]; then + echo "Failed to parse version from branch ${BRANCH}, skip dispatch." + echo "version=" >> "$GITHUB_OUTPUT" + exit 0 + fi + echo "Parsed version: ${VERSION}" + echo "version=${VERSION}" >> "$GITHUB_OUTPUT" + + - name: Send repository_dispatch develop-synced + if: steps.version.outputs.version != '' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + set -euo pipefail + VERSION="${{ steps.version.outputs.version }}" + OWNER_REPO="${GITHUB_REPOSITORY}" + + echo "Sending repository_dispatch develop-synced for version ${VERSION} to ${OWNER_REPO}" + + curl -X POST \ + -H "Accept: application/vnd.github+json" \ + -H "Authorization: Bearer ${GITHUB_TOKEN}" \ + "https://api.github.com/repos/${OWNER_REPO}/dispatches" \ + -d "{\"event_type\":\"develop-synced\",\"client_payload\":{\"version\":\"${VERSION}\"}}" diff --git a/.github/workflows/post-release.yml b/.github/workflows/post-release.yml new file mode 100644 index 0000000000..3be564acba --- /dev/null +++ b/.github/workflows/post-release.yml @@ -0,0 +1,144 @@ +name: Post release after develop synced (Scheme A) + +on: + repository_dispatch: + types: [develop-synced] + +jobs: + post_release: + runs-on: ubuntu-latest + + permissions: + contents: write + + steps: + - name: Read version from repository_dispatch payload + id: meta + env: + PAYLOAD_VERSION: ${{ github.event.client_payload.version }} + run: | + set -euo pipefail + if [ -z "${PAYLOAD_VERSION}" ]; then + echo "No version in client_payload, skip post-release." + echo "skip=true" >> "$GITHUB_OUTPUT" + exit 0 + fi + echo "Using version from payload: ${PAYLOAD_VERSION}" + echo "version=${PAYLOAD_VERSION}" >> "$GITHUB_OUTPUT" + echo "skip=false" >> "$GITHUB_OUTPUT" + + - name: Checkout main + if: steps.meta.outputs.skip != 'true' + uses: actions/checkout@v4 + with: + ref: main + fetch-depth: 0 + + - name: Fetch tags + if: steps.meta.outputs.skip != 'true' + run: | + set -euo pipefail + git fetch --tags --force + + - name: Check existing tag and release + id: exist + if: steps.meta.outputs.skip != 'true' + env: + VERSION: ${{ steps.meta.outputs.version }} + GH_TOKEN: ${{ github.token }} + run: | + set -euo pipefail + TAG="v${VERSION}" + + if git rev-parse "refs/tags/${TAG}" >/dev/null 2>&1; then + echo "Tag ${TAG} already exists, skip post-release." + echo "skip=true" >> "$GITHUB_OUTPUT" + exit 0 + fi + + if gh release view "${TAG}" >/dev/null 2>&1; then + echo "Release ${TAG} already exists, skip post-release." + echo "skip=true" >> "$GITHUB_OUTPUT" + exit 0 + fi + + echo "skip=false" >> "$GITHUB_OUTPUT" + + - name: Fetch develop changelog + if: steps.meta.outputs.skip != 'true' && steps.exist.outputs.skip != 'true' + run: | + set -euo pipefail + git fetch origin develop:refs/remotes/origin/develop --depth=1 + git show origin/develop:docs/assets/changelog/en/release.md > release-develop.md + + - name: Extract release body from develop changelog + id: body + if: steps.meta.outputs.skip != 'true' && steps.exist.outputs.skip != 'true' + env: + VERSION: ${{ steps.meta.outputs.version }} + run: | + set -euo pipefail + if [ ! -f "release-develop.md" ]; then + echo "develop changelog file not found, skip post-release." + echo "has_body=false" >> "$GITHUB_OUTPUT" + exit 0 + fi + + if node <<'NODE' + const fs = require('fs'); + + const version = process.env.VERSION; + const content = fs.readFileSync('release-develop.md', 'utf8'); + + function escapeRegExp(str) { + return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); + } + + const headerPattern = new RegExp('^#\\s*v?' + escapeRegExp(version) + '\\b', 'm'); + const match = headerPattern.exec(content); + + if (!match) { + console.log('No changelog block for version', version, 'found in develop.'); + process.exit(1); + } + + const startIndex = match.index; + const rest = content.slice(startIndex); + + const nextHeaderPattern = /^#\s*v?\d+\.\d+\.\d+[^\n]*$/gm; + let nextIndex = rest.length; + let m; + if ((m = nextHeaderPattern.exec(rest)) !== null && m.index !== 0) { + nextIndex = m.index; + } + + const block = rest.slice(0, nextIndex).trimEnd() + '\n'; + fs.writeFileSync('release-body.md', block, 'utf8'); + NODE + then + echo "has_body=true" >> "$GITHUB_OUTPUT" + else + echo "has_body=false" >> "$GITHUB_OUTPUT" + fi + + - name: Create tag and GitHub Release + if: steps.meta.outputs.skip != 'true' && steps.exist.outputs.skip != 'true' && steps.body.outputs.has_body == 'true' + env: + VERSION: ${{ steps.meta.outputs.version }} + GH_TOKEN: ${{ github.token }} + run: | + set -euo pipefail + TAG="v${VERSION}" + + git fetch origin main:refs/remotes/origin/main --depth=1 + MAIN_SHA="$(git rev-parse origin/main)" + + echo "Creating tag ${TAG} at ${MAIN_SHA}" + git tag "${TAG}" "${MAIN_SHA}" + git push origin "${TAG}" + + echo "Creating GitHub Release ${TAG}" + gh release create "${TAG}" \ + --target "main" \ + --title "${TAG}" \ + --notes-file "release-body.md" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3c137b17c5..1f44b49e69 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,4 +1,4 @@ -name: Release CI +name: Release CI (scheme A - changelog-first) on: push: @@ -11,20 +11,32 @@ on: - 'pre-release/[0-9]+\.[0-9]+\.[0-9]+-hotfix\.[0-9]+' jobs: - build: + release: runs-on: macos-latest permissions: - id-token: write - contents: write - pull-requests: write + id-token: write # OIDC for npm publish (single entry) + contents: write # push commits / tags + pull-requests: write # create PR from release/* to main strategy: matrix: node-version: [20.x] + concurrency: + group: vchart-release-${{ github.ref_name }} + cancel-in-progress: false + + env: + RUSH_NODE_OPTIONS: '--max_old_space_size=4096' + steps: - - uses: actions/checkout@v4 - - run: | + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Configure Git identity + run: | git config user.name ${{ github.actor }} git config user.email ${{ github.actor }}@users.noreply.github.com @@ -69,7 +81,7 @@ jobs: - name: Install rush run: node common/scripts/install-run-rush.js install --bypass-policy - # Release flow + # ===== Release flow (stable) ===== - name: Parse semver (release) if: startsWith(github.ref_name, 'release/') id: semver_release @@ -86,48 +98,237 @@ jobs: release_version: ${{ steps.semver_release.outputs.full }} write_next_bump: true - - name: Generate changelog (release) + - name: Generate changelog blocks from changefiles (release) + if: startsWith(github.ref_name, 'release/') + env: + CHANGELOG_API_URL: ${{ secrets.VCHART_CHANGELOG_API_URL }} + CHANGELOG_API_TOKEN: ${{ secrets.VCHART_CHANGELOG_API_TOKEN }} + RELEASE_VERSION: ${{ steps.semver_release.outputs.main }} + run: | + node <<'NODE' + const fs = require('fs'); + const path = require('path'); + const { execSync } = require('child_process'); + + const baseDir = path.join(process.cwd(), 'common', 'changes', '@visactor', 'vchart'); + let changefiles = []; + + try { + const files = fs.readdirSync(baseDir).filter((name) => name.endsWith('.json')); + for (const file of files) { + const fullPath = path.join(baseDir, file); + const json = JSON.parse(fs.readFileSync(fullPath, 'utf8')); + changefiles.push(json); + } + console.log('Collected changefiles:', changefiles.length); + } catch (e) { + console.log('No changefiles found or unable to read, fallback to empty list.', e.message || e); + } + + const version = process.env.RELEASE_VERSION; + if (!version) { + console.error('Missing RELEASE_VERSION env.'); + process.exit(1); + } + + let prevVersion = process.env.PREV_VERSION || ''; + try { + if (!prevVersion) { + const out = execSync('git tag --list "v*.*.*" --sort=-v:refname', { encoding: 'utf8' }); + const tags = out.split(/\r?\n/).map((s) => s.trim()).filter(Boolean); + if (tags.length > 0) { + const first = tags[0].replace(/^v/i, ''); + if (first !== version && !first.startsWith(version + '-')) { + prevVersion = first; + } else if (tags.length > 1) { + prevVersion = tags[1].replace(/^v/i, ''); + } + } + } + } catch (e) { + console.log('Failed to detect previous version from tags, continue without it:', e.message || e); + } + + const payload = { + version, + prevVersion: prevVersion || undefined, + date: new Date().toISOString().slice(0, 10), + changefiles, + langs: ['en', 'zh'], + reuseHarmonyFromEn: true, + template: 'default', + }; + + const baseUrl = process.env.CHANGELOG_API_URL; + const token = process.env.CHANGELOG_API_TOKEN; + + function writeFallback() { + const date = payload.date; + const enLines = [ + `# v${version}`, + '', + date, + '', + '**🆕 New Features**', + '', + `- TODO: Fill in change details for v${version}.`, + '', + ]; + const zhLines = [ + `# v${version}`, + '', + date, + '', + '**🆕 新增功能**', + '', + `- TODO:补充 v${version} 的更新内容。`, + '', + ]; + fs.mkdirSync('.changelog', { recursive: true }); + fs.writeFileSync('.changelog/en.md', enLines.join('\n') + '\n', 'utf8'); + fs.writeFileSync('.changelog/zh.md', zhLines.join('\n') + '\n', 'utf8'); + fs.writeFileSync('.changelog/harmony.md', enLines.join('\n') + '\n', 'utf8'); + console.log('Wrote fallback changelog blocks for version', version); + } + + if (!baseUrl || !token) { + console.log('CHANGELOG_API_URL or CHANGELOG_API_TOKEN not configured, using fallback template.'); + writeFallback(); + process.exit(0); + } + + const url = new URL('/api/changelog/vchart/generate', baseUrl); + const body = JSON.stringify(payload); + + const isHttps = url.protocol === 'https:'; + const httpModule = isHttps ? require('https') : require('http'); + + const options = { + method: 'POST', + hostname: url.hostname, + port: url.port || (isHttps ? 443 : 80), + path: url.pathname + url.search, + headers: { + 'Content-Type': 'application/json', + Authorization: `Bearer ${token}`, + 'Content-Length': Buffer.byteLength(body), + }, + }; + + const req = httpModule.request(options, (res) => { + let data = ''; + res.on('data', (chunk) => (data += chunk)); + res.on('end', () => { + if (res.statusCode && res.statusCode >= 200 && res.statusCode < 300) { + try { + const parsed = JSON.parse(data || '{}'); + const en = parsed.blocks && parsed.blocks.en; + const zh = parsed.blocks && parsed.blocks.zh; + const harmony = parsed.harmony || en; + if (!en || !zh) { + throw new Error('Missing en/zh blocks in response'); + } + fs.mkdirSync('.changelog', { recursive: true }); + fs.writeFileSync('.changelog/en.md', String(en).trimEnd() + '\n', 'utf8'); + fs.writeFileSync('.changelog/zh.md', String(zh).trimEnd() + '\n', 'utf8'); + fs.writeFileSync('.changelog/harmony.md', String(harmony).trimEnd() + '\n', 'utf8'); + console.log('Changelog blocks generated via API. traceId:', parsed.traceId || '(none)'); + } catch (e) { + console.error('Failed to parse API response, fallback to template:', e.message || e); + writeFallback(); + } + } else { + console.error('Changelog API returned non-2xx status:', res.statusCode, data); + writeFallback(); + } + }); + }); + + req.on('error', (err) => { + console.error('Changelog API request failed, fallback to template:', err.message || err); + writeFallback(); + }); + + req.write(body); + req.end(); + NODE + + - name: Prepend changelog blocks into release docs (release) + if: startsWith(github.ref_name, 'release/') + run: | + set -euo pipefail + mkdir -p docs/assets/changelog/en docs/assets/changelog/zh + + for lang in en zh; do + block_file=".changelog/${lang}.md" + target_file="docs/assets/changelog/${lang}/release.md" + if [ -f "$block_file" ]; then + if [ -f "$target_file" ]; then + cp "$target_file" "${target_file}.bak" + cat "$block_file" "${target_file}.bak" > "$target_file" + else + cp "$block_file" "$target_file" + fi + else + echo "Missing changelog block for $lang, skip." + fi + done + + harmony_block=".changelog/harmony.md" + harmony_target="packages/harmony_vchart/library/CHANGELOG.md" + if [ -f "$harmony_block" ]; then + if [ -f "$harmony_target" ]; then + cp "$harmony_target" "${harmony_target}.bak" + cat "$harmony_block" "${harmony_target}.bak" > "$harmony_target" + else + cp "$harmony_block" "$harmony_target" + fi + else + echo "Missing harmony changelog block, skip." + fi + + - name: Generate rush version (release) if: startsWith(github.ref_name, 'release/') run: node common/scripts/install-run-rush.js version --bump - name: Update version (release) if: startsWith(github.ref_name, 'release/') - run: node common/scripts/apply-release-version.js 'none' ${{ steps.semver_release.outputs.main }} + run: node common/scripts/apply-release-version.js 'none' ${{ steps.semver_release.outputs.main }} - name: Build vutils-extension && vchart env: - NODE_OPTIONS: '--max_old_space_size=4096' + NODE_OPTIONS: ${{ env.RUSH_NODE_OPTIONS }} run: node common/scripts/install-run-rush.js build --to @visactor/vchart - name: Build vchart-extension if: startsWith(github.ref_name, 'release/') || startsWith(github.ref_name, 'pre-release/') env: - NODE_OPTIONS: '--max_old_space_size=4096' + NODE_OPTIONS: ${{ env.RUSH_NODE_OPTIONS }} run: node common/scripts/install-run-rush.js build --only @visactor/vchart-extension - name: Build react-vchart env: - NODE_OPTIONS: '--max_old_space_size=4096' + NODE_OPTIONS: ${{ env.RUSH_NODE_OPTIONS }} run: node common/scripts/install-run-rush.js build --only @visactor/react-vchart - name: Build openinula-vchart env: - NODE_OPTIONS: '--max_old_space_size=4096' + NODE_OPTIONS: ${{ env.RUSH_NODE_OPTIONS }} run: node common/scripts/install-run-rush.js build --only @visactor/openinula-vchart - name: Build taro-vchart env: - NODE_OPTIONS: '--max_old_space_size=4096' + NODE_OPTIONS: ${{ env.RUSH_NODE_OPTIONS }} run: node common/scripts/install-run-rush.js build --only @visactor/taro-vchart - name: Build lark-vchart env: - NODE_OPTIONS: '--max_old_space_size=4096' + NODE_OPTIONS: ${{ env.RUSH_NODE_OPTIONS }} run: node common/scripts/install-run-rush.js build --only @visactor/lark-vchart - name: Build wx-vchart env: - NODE_OPTIONS: '--max_old_space_size=4096' + NODE_OPTIONS: ${{ env.RUSH_NODE_OPTIONS }} run: node common/scripts/install-run-rush.js build --only @visactor/wx-vchart - name: Publish to npm (release) @@ -147,45 +348,33 @@ jobs: - name: Commit & Push changes (release) if: startsWith(github.ref_name, 'release/') run: | - git add . - git commit -m 'build: release version ${{ steps.package_version_release.outputs.current_version }} [skip ci]' -n - git push --no-verify origin ${{ github.ref_name }} - - - name: Collect changelog of rush (release) + set -euo pipefail + if git diff --quiet; then + echo 'No changes to commit for release branch.' + else + git add . + git commit -m "build: release version ${{ steps.package_version_release.outputs.current_version }} [skip ci]" -n + git push --no-verify origin ${{ github.ref_name }} + fi + + - name: Create Pull Request to main (release) if: startsWith(github.ref_name, 'release/') - uses: xile611/collect-rush-changlog@main - id: changelog_release - with: - version: ${{ steps.package_version_release.outputs.current_version }} - - - name: Create Release for Tag (release) - if: startsWith(github.ref_name, 'release/') - id: release_tag_release - uses: ncipollo/release-action@v1.12.0 env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag: v${{ steps.package_version_release.outputs.current_version }} - commit: main - prerelease: false - body: | - ${{ steps.changelog_release.outputs.markdown }} - draft: true - - - name: Create Pull Request (release) - if: startsWith(github.ref_name, 'release/') - uses: dustinirving/create-pr@v1.0.2 - with: - token: ${{ secrets.GITHUB_TOKEN }} - title: '[Auto release] release ${{ steps.package_version_release.outputs.current_version }}' - base: main - head: ${{ github.ref_name }} - labels: release - reviewers: kkxxkk2019 - body: | - ${{ steps.changelog_release.outputs.markdown }} - - # Hotfix flow + GH_TOKEN: ${{ github.token }} + run: | + set -euo pipefail + BRANCH="${GITHUB_REF_NAME}" + echo "Source branch: $BRANCH" + # Check if PR already exists + if gh pr list --base main --head "$BRANCH" --state open --json number --limit 1 | grep -q '"number"'; then + echo "PR from $BRANCH to main already exists, skip creating."; + exit 0; + fi + TITLE="[Auto release] release ${{ steps.package_version_release.outputs.current_version }}" + BODY="This PR merges release branch $BRANCH into main." + gh pr create --base main --head "$BRANCH" --title "$TITLE" --body "$BODY" + + # ===== Hotfix flow ===== - name: Parse semver (hotfix) if: startsWith(github.ref_name, 'hotfix/') id: semver_hotfix @@ -202,13 +391,13 @@ jobs: release_version: ${{ steps.semver_hotfix.outputs.full }} write_next_bump: true - - name: Generate changelog (hotfix) + - name: Generate rush version (hotfix) if: startsWith(github.ref_name, 'hotfix/') run: node common/scripts/install-run-rush.js version --bump - name: Update version (hotfix) if: startsWith(github.ref_name, 'hotfix/') - run: node common/scripts/apply-release-version.js 'none' ${{ steps.semver_hotfix.outputs.main }} + run: node common/scripts/apply-release-version.js 'none' ${{ steps.semver_hotfix.outputs.main }} - name: Publish to npm (hotfix) if: startsWith(github.ref_name, 'hotfix/') @@ -224,32 +413,16 @@ jobs: - name: Commit & Push changes (hotfix) if: startsWith(github.ref_name, 'hotfix/') run: | - git add . - git commit -m 'build: prelease version ${{ steps.package_version_hotfix.outputs.current_version }} [skip ci]' -n - git push --no-verify origin ${{ github.ref_name }} - - - name: Collect changelog of rush (hotfix) - if: startsWith(github.ref_name, 'hotfix/') - uses: xile611/collect-rush-changlog@main - id: changelog_hotfix - with: - version: ${{ steps.package_version_hotfix.outputs.current_version }} - - - name: Create Release for Tag (hotfix) - if: startsWith(github.ref_name, 'hotfix/') - id: release_tag_hotfix - uses: ncipollo/release-action@v1.12.0 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag: v${{ steps.package_version_hotfix.outputs.current_version }} - commit: ${{ github.ref_name }} - prerelease: false - body: | - ${{ steps.changelog_hotfix.outputs.markdown }} - draft: true - - # Pre-release flow + set -euo pipefail + if git diff --quiet; then + echo 'No changes to commit for hotfix branch.' + else + git add . + git commit -m "build: hotfix version ${{ steps.package_version_hotfix.outputs.current_version }} [skip ci]" -n + git push --no-verify origin ${{ github.ref_name }} + fi + + # ===== Pre-release flow ===== - name: Parse semver (pre-release) if: startsWith(github.ref_name, 'pre-release/') id: semver_prerelease @@ -277,6 +450,11 @@ jobs: - name: Commit & Push changes (pre-release) if: startsWith(github.ref_name, 'pre-release/') run: | - git add . - git commit -m 'build: prerelease version ${{ steps.package_version_prerelease.outputs.current_version }} [skip ci]' -n - git push --no-verify origin ${{ github.ref_name }} + set -euo pipefail + if git diff --quiet; then + echo 'No changes to commit for pre-release branch.' + else + git add . + git commit -m "build: prerelease version ${{ steps.package_version_prerelease.outputs.current_version }} [skip ci]" -n + git push --no-verify origin ${{ github.ref_name }} + fi diff --git a/.github/workflows/sync-main-to-develop.yml b/.github/workflows/sync-main-to-develop.yml index cb60d39411..00cdbbcfbf 100644 --- a/.github/workflows/sync-main-to-develop.yml +++ b/.github/workflows/sync-main-to-develop.yml @@ -1,4 +1,4 @@ -name: Sync main to develop after release +name: Sync main to develop after release (Scheme A) on: pull_request: @@ -8,8 +8,8 @@ on: - main jobs: - if_merged: - if: github.event.pull_request.merged == true + sync_main_to_develop: + if: github.event.pull_request.merged == true && startsWith(github.event.pull_request.head.ref, 'release/') runs-on: macos-latest @@ -19,16 +19,19 @@ jobs: strategy: matrix: - node-version: [18.x] + node-version: [20.x] steps: - - uses: actions/checkout@v3 - - run: | + - name: Checkout + uses: actions/checkout@v4 + + - name: Configure Git identity + run: | git config user.name ${{ github.actor }} git config user.email ${{ github.actor }}@users.noreply.github.com - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 + - name: Setup Node.js + uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} cache: 'npm' @@ -61,28 +64,49 @@ jobs: - name: Install latest pnpm run: npm install -g pnpm@10.7.0 - # Install rush - name: Install rush run: node common/scripts/install-run-rush.js install --bypass-policy - - name: Get version - id: package-version + - name: Read vchart version from package.json + id: package_version uses: xile611/read-package-version-action@main with: path: packages/vchart - - name: Create a new branch + - name: Compute sync branch name and check existence + id: sync_branch run: | - git status - git checkout -b sync/main-${{ steps.package-version.outputs.current_version }} - git push --no-verify origin sync/main-${{ steps.package-version.outputs.current_version }} - - - name: Create Pull Request + set -euo pipefail + VERSION="${{ steps.package_version.outputs.current_version }}" + BRANCH="sync/main-${VERSION}" + echo "sync_branch=${BRANCH}" >> "$GITHUB_OUTPUT" + + git fetch origin "${BRANCH}":refs/remotes/origin/tmp-sync-branch 2>/dev/null || true + if git ls-remote --exit-code --heads origin "${BRANCH}" > /dev/null 2>&1; then + echo "Branch ${BRANCH} already exists on origin, skip creating new sync branch." + echo "exists=true" >> "$GITHUB_OUTPUT" + else + echo "exists=false" >> "$GITHUB_OUTPUT" + fi + + - name: Create and push sync/main-X.Y.Z branch + if: steps.sync_branch.outputs.exists == 'false' + run: | + set -euo pipefail + VERSION="${{ steps.package_version.outputs.current_version }}" + BRANCH="${{ steps.sync_branch.outputs.sync_branch }}" + git checkout main + git pull --ff-only origin main + git checkout -b "${BRANCH}" + git push --no-verify origin "${BRANCH}" + + - name: Create Pull Request to develop + if: steps.sync_branch.outputs.exists == 'false' uses: dustinirving/create-pr@v1.0.2 with: token: ${{ secrets.GITHUB_TOKEN }} - title: '[Auto Sync] Sync the code from branch main to branch develop after release ${{ steps.package-version.outputs.current_version }}' + title: '[Auto Sync] Sync the code from branch main to branch develop after release ${{ steps.package_version.outputs.current_version }}' base: develop - head: sync/main-${{ steps.package-version.outputs.current_version }} + head: ${{ steps.sync_branch.outputs.sync_branch }} reviewers: xile611 - body: 'Sync the code from branch main to branch develop after release ${{ steps.package-version.outputs.current_version }}' + body: 'Sync the code from branch main to branch develop after release ${{ steps.package_version.outputs.current_version }}'