Skip to content

Update Latest Build Version #2042

Update Latest Build Version

Update Latest Build Version #2042

##############################################################################################
#
# This Workflow is responsible for updating the latest build version of the project.
# You can provide your own base branch, tag, or SHA for git operations and the pull request.
# and it will generate the latest build version & update the neccessary files for you.
#
##############################################################################################
name: Update Latest Build Version
on:
workflow_dispatch:
inputs:
base-branch:
description: 'The base branch, tag, or SHA for git operations and the pull request.'
required: true
type: string
workflow_call:
inputs:
base-branch:
description: 'The base branch, tag, or SHA for git operations and the pull request.'
required: true
type: string
secrets:
PR_TOKEN:
description: 'GitHub token for checkout and push operations.'
required: true
outputs:
build-version:
description: 'Generated build version number'
value: ${{ jobs.generate-build-version.outputs.build-version }}
commit-hash:
description: 'Commit hash with build version bumped'
value: ${{ jobs.bump-version.outputs.commit-hash }}
jobs:
generate-build-version:
uses: MetaMask/metamask-mobile-build-version/.github/workflows/metamask-mobile-build-version.yml@v0.3.0
permissions:
id-token: write
bump-version:
runs-on: ubuntu-latest
needs: generate-build-version
outputs:
commit-hash: ${{ steps.bump-build-version.outputs.commit-hash }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ inputs.base-branch }}
token: ${{ secrets.PR_TOKEN || github.token }}
- name: Bump build version
id: bump-build-version
shell: bash
env:
BUILD_NUMBER: ${{ needs.generate-build-version.outputs.build-version }}
HEAD_REF: ${{ inputs.base-branch }}
run: |
./scripts/set-build-version.sh "$BUILD_NUMBER"
git diff
git config user.name metamaskbot
git config user.email metamaskbot@users.noreply.github.com
git add bitrise.yml
git add package.json
git add ios/MetaMask.xcodeproj/project.pbxproj
git add android/app/build.gradle
git commit -m "[skip ci] Bump version number to ${BUILD_NUMBER}"
git push origin HEAD:"$HEAD_REF" --force-with-lease
echo "commit-hash=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT"