Merge pull request #546 from mindbox-cloud/hotfix/WMRUSTORE-36 #3
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: Prepare release branch | |
on: | |
push: | |
branches: | |
- 'release/*.*.*' | |
- 'support/*.*.*' | |
jobs: | |
extract_version: | |
if: github.event.created | |
name: Extract Version | |
runs-on: ubuntu-latest | |
outputs: | |
version: ${{ steps.extract.outputs.version }} | |
steps: | |
- name: Extract version from branch name | |
id: extract | |
run: | | |
BRANCH_NAME="${{ github.ref_name }}" | |
echo "BRANCH_NAME: $BRANCH_NAME" | |
VERSION="${BRANCH_NAME#release/}" | |
VERSION="${VERSION#support/}" | |
echo "VERSION: $VERSION" | |
echo "version=${VERSION}" >> $GITHUB_OUTPUT | |
bump_version: | |
name: Bump Version | |
runs-on: ubuntu-latest | |
needs: extract_version | |
outputs: | |
version2: ${{ steps.bump.outputs.version2 }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Configure Git identity for GitHub Action Bot | |
run: | | |
git config user.name "github-actions[bot]" | |
git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
- name: Bump version | |
run: ./.github/bump_versions_in_release_branch.sh "${{ needs.extract_version.outputs.version }}" | |
- name: Ouput version | |
id: bump | |
run: | | |
echo "version2=${{ needs.extract_version.outputs.version }}" >> $GITHUB_OUTPUT | |
check_sdk_version: | |
name: Check SDK Version | |
runs-on: ubuntu-latest | |
needs: bump_version | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Pull latest changes | |
run: git pull | |
- name: Check if SDK_VERSION_NAME matches VERSION | |
run: | | |
SDK_VERSION=$(grep '^SDK_VERSION_NAME=' gradle.properties | cut -d '=' -f2) | |
EXPECTED_VERSION=${{ needs.bump_version.outputs.version2 }} | |
if [ "$SDK_VERSION" != "$EXPECTED_VERSION" ]; then | |
echo "SDK_VERSION_NAME ($ACTUAL_VERSION) does not match the expected version ($EXPECTED_VERSION)." | |
exit 1 | |
fi | |
shell: bash | |
create_pull_request: | |
name: Create Pull Request | |
runs-on: ubuntu-latest | |
needs: check_sdk_version | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Create Pull Request | |
run: | | |
gh pr create \ | |
--base master \ | |
--head ${{ github.ref_name }} \ | |
--title "${{ github.ref_name }}" \ | |
--body "Updates the release version to ${{ github.ref_name }}" | |
PR_URL=$(gh pr view --json url --jq '.url') | |
echo "PR_URL=$PR_URL" >> $GITHUB_ENV | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |