Update .github/workflows/prepare-for-minor-release.yml #11
Workflow file for this run
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 repository for new minor release | ||
run-name: Update az_quickstart repository for new `${{ inputs.release_branch_name }}` minor release branch. | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
release_branch_name: | ||
description: The name of the new release branch (e.g. 2.8.x) to create. | ||
required: true | ||
jobs: | ||
print_inputs: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Print inputs | ||
run: | | ||
echo "release_branch_name: ${{ inputs.release_branch_name }}" | ||
branch_name_prep: | ||
timeout-minutes: 60 | ||
runs-on: ubuntu-latest | ||
outputs: | ||
next_release_branch_alias_constraint: ${{ steps.alias-next-version-constraint.outputs.NEXT_RELEASE_VERSION_CONSTRAINT }} | ||
this_release_branch_alias_constraint: ${{ steps.alias-version-constraint.outputs.THIS_RELEASE_VERSION_CONSTRAINT }} | ||
main_branch_alias: ${{ steps.alias-main-branch.outputs.MAIN_BRANCH_ALIAS }} | ||
steps: | ||
- name: Create version contstraint string for next release branch alias string. | ||
id: alias-next-version-constraint | ||
run: | | ||
local delimiter=. | ||
local version_parts=($(echo ${{ inputs.release_branch_name }} | tr $delimiter '\n')) | ||
version_parts[2]=$((version_parts[2]+1)) | ||
NEXT_RELEASE_VERSION_CONSTRAINT=$(local IFS=$delimiter ; echo "${version_parts[*]}" | sed 's/\(.*\)\.x/~\1/') | ||
echo "NEXT_RELEASE_VERSION_CONSTRAINT=${NEXT_RELEASE_VERSION_CONSTRAINT}" >> $GITHUB_OUTPUT | ||
echo "Next release version constraint: $NEXT_RELEASE_VERSION_CONSTRAINT" >> $GITHUB_STEP_SUMMARY | ||
- name: Create version contstraint string for this release branch alias string. | ||
id: alias-version-constraint | ||
run: | | ||
THIS_RELEASE_VERSION_CONSTRAINT=$(echo ${{ inputs.release_branch_name }} | sed 's/\(.*\)\.x/~\1/') | ||
echo "THIS_RELEASE_VERSION_CONSTRAINT=${THIS_RELEASE_VERSION_CONSTRAINT}" >> $GITHUB_OUTPUT | ||
echo "This release version constraint: $THIS_RELEASE_VERSION_CONSTRAINT" >> $GITHUB_STEP_SUMMARY | ||
- name: Create the composer main branch alias string. | ||
id: alias-main-branch | ||
run: | | ||
MAIN_BRANCH_ALIAS="${{ inputs.release_branch_name }}-dev" | ||
echo "MAIN_BRANCH_ALIAS=${MAIN_BRANCH_ALIAS}" >> $GITHUB_OUTPUT | ||
echo "Main branch alias: $MAIN_BRANCH_ALIAS" >> $GITHUB_STEP_SUMMARY | ||
dispatch: | ||
needs: branch_name_prep | ||
strategy: | ||
matrix: | ||
repo: | ||
- az-digital/az-quickstart-scaffolding | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Notify dependencies | ||
uses: peter-evans/repository-dispatch@v2 | ||
with: | ||
token: ${{ secrets.REPO_DISPATCH_TOKEN }} | ||
repository: ${{ matrix.repo }} | ||
event-type: az_quickstart_prep_for_minor_release | ||
client-payload: '{"release_branch_name": "${{ inputs.release_branch_name }}" , "this_release_branch_alias_constraint": "${{needs.branch_name_prep.outputs.this_release_branch_alias_constraint}}", "main_branch_alias": "${{needs.branch_name_prep.outputs.main_branch_alias}}", "next_release_branch_alias_constraint": "${{inputs.next_release_branch_version_constraint}}"}' | ||
prepare_for_new_minor_release: | ||
name: Prepare for a new minor release | ||
runs-on: ubuntu-latest | ||
needs: branch_name_prep | ||
steps: | ||
- name: Checkout az_quickstart | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: az-digital/az_quickstart | ||
ref: main | ||
- name: Create and check out release branch | ||
run: | | ||
git checkout -b ${{ inputs.release_branch_name }} | ||
- name: Set up git | ||
run: | | ||
git config user.name github-actions | ||
git config user.email [email protected] | ||
- name: Push new release branch to GitHub | ||
run: | | ||
git commit --allow-empty -m "Prepare for new minor release ${{ inputs.release_branch_name }}" | ||
# git push origin -u ${{ inputs.release_branch_name }} | ||
- name: Check out new branch so we can make a pull request | ||
run: | | ||
git checkout -b ${{ inputs.release_branch_name }}-prepare-for-minor-release | ||
- name: Update DDev config in release branch | ||
run: | | ||
NEW_VERSION=${{ inputs.release_branch_name }} | ||
sed -i "0,/main/s//$NEW_VERSION/" .ddev/commands/web/install | ||
- name: Update Security workflow yml in release branch | ||
run: | | ||
NEW_VERSION=${{ inputs.release_branch_name }} | ||
sed -i "s/SCAFFOLD_BRANCH=main/SCAFFOLD_BRANCH=$NEW_VERSION/g" .github/workflows/security.yml | ||
- name: Update Create Release workflow yml in release branch | ||
run: | | ||
NEW_VERSION=${{ inputs.release_branch_name }} | ||
sed -i "s|git clone https://github.com/az-digital/az-quickstart-scaffolding.git az_quickstart|git clone -b $NEW_VERSION https://github.com/az-digital/az-quickstart-scaffolding.git az_quickstart|" .github/workflows/create-release.yml | ||
- name: Update Lando config in release branch | ||
run: | | ||
NEW_VERSION=${{ inputs.release_branch_name }} | ||
sed -i "s/SCAFFOLD_BRANCH=main/SCAFFOLD_BRANCH=$NEW_VERSION/g" .lando.yml | ||
- name: Update Probo config in release branch | ||
run: | | ||
NEW_VERSION=${{ inputs.release_branch_name }} | ||
sed -i "s/SCAFFOLD_BRANCH=main/SCAFFOLD_BRANCH=$NEW_VERSION/g" .probo.yaml | ||
- name: Setup PHP with composer v2 | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: '8.1' | ||
tools: composer:v2 | ||
- name: Update dev branch alias via Composer | ||
run: | | ||
composer config extra.branch-alias.dev-main ${{ inputs.release_branch_name }}-dev | ||
- name: Add changed files to release branch commit | ||
run: | | ||
git diff | ||
git add .ddev/commands/web/install | ||
git add .github/workflows/security.yml | ||
git add .github/workflows/create-release.yml | ||
git add .lando.yml | ||
git add .probo.yaml | ||
git add composer.json | ||
# - name: Push required changes to new branch so we can make a pull request | ||
# uses: peter-evans/create-pull-request@v5 | ||
# with: | ||
# title: Prepare repository for new minor release branch ${{ inputs.release_branch_name }} | ||
# commit-message: Prepare repository for new minor release branch ${{ inputs.release_branch_name }} | ||
# branch: ${{ inputs.release_branch_name }}-prepare-for-minor-release | ||
# base: ${{ inputs.release_branch_name }} | ||
# delete-branch: true | ||
update_previous_release_branches: | ||
needs: prepare_for_new_minor_release | ||
runs-on: ubuntu-latest | ||
name: Update `${{ matrix.previous_version }}` release branch. | ||
strategy: | ||
matrix: | ||
previous_version: [2.7.x, 2.6.x, 2.5.x, 2.4.x, 2.3.x, 2.2.x, 2.1.x, 2.0.x] | ||
steps: | ||
- name: Update previous release branch `${{ matrix.previous_version }}` | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ matrix.previous_version }} | ||
- name: Set up Git | ||
run: | | ||
git config user.name "GitHub Action" | ||
git config user.email "[email protected]" | ||
- name: Check out new branch so we can make a pull request | ||
run: | | ||
git checkout -b ${{ matrix.previous_version }}-update-for-${{ inputs.release_branch_name }} | ||
- name: Show git diff | ||
run: git diff ${{ matrix.previous_version }} | ||
- name: Update dev branch alias via Composer | ||
run: | | ||
composer config extra.branch-alias.dev-main ${{ inputs.release_branch_name }}-dev | ||
- name: Show git status | ||
run: | | ||
git status | ||
- name: Show git diff | ||
run: git diff | ||
# - name: Push required changes to new branch so we can make a pull request | ||
# uses: peter-evans/create-pull-request@v5 | ||
# with: | ||
# title: Prepare ${{ matrix.previous_version }} branch for new minor release branch ${{ inputs.release_branch_name }} | ||
# commit-message: Prepare ${{ matrix.previous_version }} branch for new minor release branch ${{ inputs.release_branch_name }} | ||
# branch: ${{ matrix.previous_version }}-update-for-${{ inputs.release_branch_name }} | ||
# base: ${{ matrix.previous_version }} | ||
# delete-branch: true |