Skip to content

prepare next release (#1536) #5

prepare next release (#1536)

prepare next release (#1536) #5

Workflow file for this run

name: Update branch alias
on:
push:
tags: ['*']
jobs:
branch-alias:
name: Update branch alias
runs-on: ubuntu-latest
steps:
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.1
coverage: none
- name: Find branch alias
id: find_alias
run: |
TAG=$(echo $GITHUB_REF | cut -d'/' -f 3)
echo "Last tag was $TAG"
ARR=(${TAG//./ })
ARR[1]=$((${ARR[1]}+1))
echo "alias=${ARR[0]}.${ARR[1]}" >> $GITHUB_OUTPUT
- name: Checkout main repo
run: |
git clone --branch master https://${{ secrets.BOT_GITHUB_TOKEN }}:x-oauth-basic@github.com/async-aws/aws aws
- name: Update branch alias
run: |
cd aws/src/Service/AppSync
CURRENT_ALIAS=$(composer config extra.branch-alias.dev-master | cut -d'-' -f 1)
# If there is a current value on the branch alias
if [ ! -z $CURRENT_ALIAS ]; then
NEW_ALIAS=${{ steps.find_alias.outputs.alias }}
CURRENT_ARR=(${CURRENT_ALIAS//./ })
NEW_ARR=(${NEW_ALIAS//./ })
if [ ${CURRENT_ARR[0]} -gt ${NEW_ARR[0]} ]; then
echo "The current value for major version is larger"
exit 1;
fi
if [ ${CURRENT_ARR[0]} -eq ${NEW_ARR[0]} ] && [ ${CURRENT_ARR[1]} -gt ${NEW_ARR[1]} ]; then
echo "The current value for minor version is larger"
exit 1;
fi
fi
composer config extra.branch-alias.dev-master ${{ steps.find_alias.outputs.alias }}-dev
- name: Commit & push the new files
run: |
echo "::group::git status"
cd aws
git status
echo "::endgroup::"
git add -N .
if [[ $(git diff --numstat | wc -l) -eq 0 ]]; then
echo "No changes found. Exiting."
exit 0;
fi
git config --local user.email "github@async-aws.com"
git config --local user.name "AsyncAws Bot"
echo "::group::git push"
git add .
git commit -m "Update branch alias"
git push
echo "::endgroup::"