Bump version number #26
This file contains hidden or 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 number | |
| on: | |
| workflow_dispatch: | |
| jobs: | |
| bump_version: | |
| runs-on: ubuntu-latest | |
| if: github.repository == 'ruffle-rs/ruffle-android' | |
| strategy: | |
| max-parallel: 1 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Get current date | |
| uses: josStorer/[email protected] | |
| id: current_date | |
| with: | |
| format: YYMMDD | |
| - name: Bump version number | |
| run: | | |
| version_code="${{ steps.current_date.outputs.formattedTime }}" | |
| version_name="0.${{ steps.current_date.outputs.formattedTime }}" | |
| sed -E -i "s/versionCode = .+/versionCode = $version_code/" app/build.gradle.kts | |
| sed -E -i "s/versionName = \".+\"/versionName = \"$version_name\"/" app/build.gradle.kts | |
| - name: Commit | |
| run: | | |
| git config user.name "RuffleBuild" | |
| git config user.email "[email protected]" | |
| git checkout -b bump-version | |
| git add -A | |
| git commit -m 'Bump version number' | |
| - name: Push | |
| uses: ad-m/github-push-action@master | |
| with: | |
| branch: bump-version | |
| github_token: ${{ secrets.RUFFLE_BUILD_TOKEN }} | |
| force: true | |
| - name: Create a PR | |
| run: | | |
| prs=$(gh pr list --base main --head bump-version --limit 1 --json id | jq length) | |
| if [ "$prs" = 1 ]; then echo "PR already exists"; exit 0; fi | |
| pr_url=$(gh pr create \ | |
| --title 'Bump version number' \ | |
| --body '⬆️' \ | |
| --head bump-version \ | |
| --base main) | |
| env: | |
| # Use a custom token rather than the automatic GITHUB_TOKEN, as the automatic one doesn't allow created PRs to trigger workflows | |
| # By using our own token (and thus own user), workflows will run, and the PR will be able to be merged. | |
| GITHUB_TOKEN: ${{ secrets.RUFFLE_BUILD_TOKEN }} |