流程优化 #19
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
on: | |
push: | |
branches: | |
- main | |
permissions: | |
contents: write | |
name: Bump | |
jobs: | |
bump: | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: 更新构建号 | |
uses: yanamura/ios-bump-version@v1 | |
- name: 生成标签 | |
run: | | |
versionLine=$(xcodebuild -showBuildSettings -quiet | grep -m 1 MARKETING_VERSION | cut -d= -f2) | |
echo "versionLine=$versionLine" | |
version=${versionLine# } | |
echo "version=$version" | |
build=$(agvtool what-version -terse) | |
echo "tag=v$version($build)" >> $GITHUB_ENV | |
- name: 打标签并推送到仓库 | |
uses: stefanzweifel/git-auto-commit-action@v4 | |
with: | |
commit_message: 'chore(workflow): Bump a new version' | |
commit_user_name: GitHub Action | |
tagging_message: ${{ env.tag }} | |
rebase: | |
needs: | |
- bump | |
runs-on: ubuntu-latest | |
steps: | |
- name: 拉取 dev 分支 | |
uses: actions/checkout@v3 | |
with: | |
ref: dev | |
- name: 拉取 main 分支 | |
run: git fetch origin main | |
- name: Rebase dev on main | |
continue-on-error: true | |
run: git rebase origin/main | |
- name: Push the rebased dev branch | |
continue-on-error: true | |
run: git push origin dev |