-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
28 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -63,7 +63,6 @@ | |
# title: "Update version to $TAG_VERSION" | ||
# body: "This PR updates the version file to the new tag version $TAG_VERSION." | ||
|
||
|
||
name: Upgrade version by tag | ||
|
||
permissions: | ||
|
@@ -78,6 +77,9 @@ on: | |
jobs: | ||
upgrade_version: | ||
runs-on: ubuntu-latest | ||
env: | ||
TAG_VERSION: ${{ github.ref_name }} # 使用GitHub提供的ref_name来捕获tag名称 | ||
BRANCH_NAME: update-version-${{ github.ref_name }} # 设置BRANCH_NAME为新的版本分支 | ||
steps: | ||
# Step 1: Checkout the original repository's code | ||
- name: Checkout code | ||
|
@@ -92,43 +94,32 @@ jobs: | |
git config user.name "github-actions[bot]" | ||
git config user.email "github-actions[bot]@users.noreply.github.com" | ||
# # Step 3: Add remote pointing to the forked repository | ||
# - name: Add fork remote | ||
# run: | | ||
# git remote add fork https://github.com/github-actions[bot]/actions-test-fork.git # 替换为官方账号的 fork 仓库 | ||
# git fetch fork | ||
|
||
# # Step 4: Create a new branch in the fork | ||
# - name: Create new branch for version update | ||
# run: | | ||
# TAG_VERSION=${GITHUB_REF#refs/tags/} | ||
# BRANCH_NAME="update-version-${TAG_VERSION}" | ||
# git checkout -b $BRANCH_NAME | ||
|
||
# # Step 5: Update version file | ||
# - name: Update version file | ||
# run: | | ||
# TAG_VERSION=${GITHUB_REF#refs/tags/} | ||
# echo "$TAG_VERSION" > version/version | ||
# git add version/version | ||
# git commit -m "Update version to $TAG_VERSION" | ||
|
||
# # Step 6: Push the new branch to the forked repository | ||
# - name: Push to forked repository | ||
# env: | ||
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # 使用 GITHUB_TOKEN 进行身份验证 | ||
# run: | | ||
# TAG_VERSION=${GITHUB_REF#refs/tags/} | ||
# BRANCH_NAME="update-version-${TAG_VERSION}" | ||
# git push fork $BRANCH_NAME | ||
|
||
# Step 7: Create a Pull Request from the fork to the original repository | ||
# Step 3: Create a new branch for version update | ||
- name: Create new branch for version update | ||
run: | | ||
git checkout -b ${{ env.BRANCH_NAME }} | ||
# Step 4: Update version file | ||
- name: Update version file | ||
run: | | ||
echo "${{ env.TAG_VERSION }}" > version/version | ||
git add version/version | ||
git commit -m "Update version to ${{ env.TAG_VERSION }}" | ||
# Step 5: Push the new branch to the repository | ||
- name: Push to repository | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # 使用 GITHUB_TOKEN 进行身份验证 | ||
run: | | ||
git push origin ${{ env.BRANCH_NAME }} | ||
# Step 6: Create a Pull Request from the new branch to the original repository | ||
- name: Create Pull Request | ||
uses: peter-evans/[email protected] | ||
with: | ||
token: ${{ secrets.BOT_TOKEN }} | ||
commit-message: "Update version to $TAG_VERSION" | ||
branch: $BRANCH_NAME | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
commit-message: "Update version to ${{ env.TAG_VERSION }}" | ||
branch: ${{ env.BRANCH_NAME }} | ||
base: main # 原始仓库的目标分支 | ||
title: "Update version to $TAG_VERSION" | ||
body: "This PR updates the version file to the new tag version $TAG_VERSION." | ||
title: "Update version to ${{ env.TAG_VERSION }}" | ||
body: "This PR updates the version file to the new tag version ${{ env.TAG_VERSION }}." |