@@ -14,29 +14,40 @@ jobs:
1414 uses : shivammathur/setup-php@v2
1515 with :
1616 php-version : ' 8.3'
17- extensions : mbstring, intl
18- tools : composer:v2
1917
20- - name : Checkout branch
21- uses : actions/checkout@v4
18+ - uses : actions/checkout@v4
2219
23- - name : Check for matching branch in Quickstart repo
24- id : check-quickstart-branch
20+ - name : Find the pull request source branch name
2521 run : |
26- if [ $(git ls-remote --heads https://github.com/az-digital/az_quickstart.git ${{ github.head_ref }} | wc -l) = 1 ]; then
27- echo "QUICKSTART_BRANCH_NAME=${{ github.head_ref }}" >> ${GITHUB_ENV}
28- else
29- echo "QUICKSTART_BRANCH_NAME=${{ github.base_ref }}" >> ${GITHUB_ENV}
30- fi
31-
32- - name : Check for matching branch in scaffolding repo
33- id : check-scaffolding-branch
22+ echo "AZ_SOURCE_REF=${GITHUB_HEAD_REF}" >> ${GITHUB_ENV}
23+ echo "AZ_TARGET_REF=${GITHUB_BASE_REF}" >> ${GITHUB_ENV}
24+ - name : Set default branches for scaffolding and profile repos if ref is 1.*
25+ if : startsWith(github.base_ref, '1.') || startsWith(github.ref_name, '1.')
26+ id : test-1-x
27+ run : |
28+ echo "DEFAULT_SCAFFOLD_BRANCH=2.x" >> ${GITHUB_ENV}
29+ echo "DEFAULT_PROFILE_BRANCH=2.x" >> ${GITHUB_ENV}
30+ - name : Fallback to main branch
31+ if : steps.test-1-x.outcome == 'skipped'
3432 run : |
35- if [ $(git ls-remote --heads https://github.com/az-digital/az-quickstart-scaffolding.git ${{ github.head_ref }} | wc -l) = 1 ]; then
36- echo "SCAFFOLDING_BRANCH_NAME=${{ github.head_ref }}" >> ${GITHUB_ENV}
33+ echo "DEFAULT_SCAFFOLD_BRANCH=main" >> ${GITHUB_ENV}
34+ echo "DEFAULT_PROFILE_BRANCH=main" >> ${GITHUB_ENV}
35+ - name : Set variables
36+ run : |
37+ if [ $(git ls-remote --heads https://github.com/az-digital/az_quickstart.git $AZ_SOURCE_REF | wc -l) = 1 ]; then
38+ echo "QUICKSTART_BRANCH_NAME=${AZ_SOURCE_REF}" >> ${GITHUB_ENV}
39+ elif [ $(git ls-remote --heads https://github.com/az-digital/az_quickstart.git $AZ_TARGET_REF | wc -l) = 1 ]; then
40+ echo "QUICKSTART_BRANCH_NAME=${AZ_TARGET_REF}" >> ${GITHUB_ENV}
3741 else
38- echo "SCAFFOLDING_BRANCH_NAME =${{ github.base_ref } }" >> ${GITHUB_ENV}
42+ echo "QUICKSTART_BRANCH_NAME =${DEFAULT_PROFILE_BRANCH }" >> ${GITHUB_ENV}
3943 fi
44+ if [ $(git ls-remote --heads https://github.com/az-digital/az-quickstart-scaffolding.git $AZ_SOURCE_REF | wc -l) = 1 ]; then
45+ echo "SCAFFOLDING_BRANCH_NAME=${AZ_SOURCE_REF}" >> ${GITHUB_ENV}
46+ elif [ $(git ls-remote --heads https://github.com/az-digital/az-quickstart-scaffolding.git $AZ_TARGET_REF | wc -l) = 1 ]; then
47+ echo "SCAFFOLDING_BRANCH_NAME=${AZ_TARGET_REF}" >> ${GITHUB_ENV}
48+ else
49+ echo "SCAFFOLDING_BRANCH_NAME=${DEFAULT_SCAFFOLD_BRANCH}" >> ${GITHUB_ENV}
50+ fi
4051
4152 - name : Checkout scaffolding repo
4253 uses : actions/checkout@v4
@@ -47,12 +58,16 @@ jobs:
4758
4859 - name : Build Arizona Quickstart
4960 run : |
50- composer self-update
5161 cd $GITHUB_WORKSPACE/az-quickstart-scaffolding
5262 composer config repositories.az_quickstart vcs https://github.com/az-digital/az_quickstart.git
5363 composer config use-github-api false
54- composer require --no-update az-digital/az_quickstart:dev-${{ env.QUICKSTART_BRANCH_NAME }}
55- composer require --no-update --dev az-digital/az-quickstart-dev:dev-${{ github.head_ref }}
64+ ./quickstart_branch.sh --branch ${QUICKSTART_BRANCH_NAME}
65+ if [[ ${AZ_SOURCE_REF} =~ ^[0-9]\.[0-9x] ]]; then
66+ DEV_PACKAGE_VERSION="${AZ_SOURCE_REF}-dev"
67+ else
68+ DEV_PACKAGE_VERSION="dev-${AZ_SOURCE_REF}"
69+ fi
70+ composer require --no-update --dev az-digital/az-quickstart-dev:${DEV_PACKAGE_VERSION}
5671 composer install -o
5772
5873 - name : Save build artifact
0 commit comments