Bump Version and Create PR #17
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
name: Bump Version and Create PR | |
on: | |
workflow_dispatch: | |
inputs: | |
bump_type: | |
description: 'Version Bump Type (patch/minor/major)' | |
required: true | |
default: 'patch' | |
jobs: | |
version-bump: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: main | |
fetch-depth: 0 | |
- name: Set up Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: '3.2.2' | |
- name: Install Fastlane | |
run: gem install fastlane | |
- name: Create new branch for version bump | |
run: | | |
git config --global user.name 'github-actions' | |
git config --global user.email '[email protected]' | |
new_branch="version-bump-${{ github.run_id }}" | |
git checkout -b $new_branch | |
- name: Run Fastlane lane for version bump | |
env: | |
GITHUB_TOKEN: ${{ secrets.ACTION_GITHUB_TOKEN }} | |
run: fastlane android version_bump type:${{ github.event.inputs.bump_type }} | |
- name: Get the latest commit message | |
id: latest-commit | |
run: | | |
commit_message=$(git log -1 --pretty=%B) | |
echo "commit_message=$commit_message" >> $GITHUB_ENV | |
- name: Push changes to origin | |
run: | | |
new_branch="version-bump-${{ github.run_id }}" | |
git remote set-url origin https://x-access-token:${{ secrets.ACTION_NEWS_FEED_V2 }}@github.com/${{ github.repository }} | |
git push --set-upstream origin $new_branch | |
- name: Create Pull Request | |
uses: repo-sync/pull-request@v2 | |
with: | |
github_token: ${{ secrets.ACTION_NEWS_FEED_V2 }} | |
source_branch: "version-bump-${{ github.run_id }}" | |
destination_branch: "main" | |
pr_title: "${{ env.commit_message }}" | |
pr_body: "This PR is auto-generated by GitHub Actions to bump the version." |