Per discussion during the February 2022 Laminas Technical Steering Committee meeting, we have a plan for adding Renovate to automate the following in Laminas and Mezzio repsitories:
- Automatically update
composer.lock
each night, without a pull request. - On test failures following ^^, open a PR.
- Automatically widen ranges for new major releases in
composer.json
and create a PR. - Separate patches for
laminas/*
upgrades, as well as other repositories.
To do this, we need to do the following in each repository:
- Add a
config.platform.php
value to thecomposer.json
corresponding to the minimum supported PHP version - Update the lockfile using a Composer v2.2+ version
- Update the CI workflow to ensure that branches created by Renovate trigger the CI workflow
To make that happen, we need your help to create the pull requests accomplishing the above.
You will need:
- git
- Composer 2.2+ (run
composer self-update --2
to ensure you have the most recent v2 release) - jq
- curl, diff, and sed (standard in all Linux distributions and generally available on Mac and WSL)
Here are the steps:
-
Clone the repository if you haven't already
-
Check out the most recent release branch (if you just cloned, this will be the branch that's checked out initially).
-
Create a new branch:
git switch -c feature/renovate
-
Run the following to add the platform PHP setting:
$ composer config platform.php $(jq -r '.require.php' < composer.json | sed -E 's/^[\^~]?(\S+).*$/\1/')
-
Update dependencies:
composer update
-
See if there are differences in the CI workflow:
$ diff -u --ignore-all-space \ <(curl -s https://raw.githubusercontent.com/laminas/laminas-eventmanager/9e11e32de9eb66451ddaba81d282cccb9bbf245f/.github/workflows/continuous-integration.yml) \ .github/workflows/continuous-integration.yml
-
If there ARE differences, change the
push.branches
setting so any branch is allowed -
If there ARE NOT differences, run the following:
$ echo 'name: "Continuous Integration" on: pull_request: push: branches: tags: jobs: ci: uses: laminas/workflow-continuous-integration/.github/workflows/[email protected]' > .github/workflows/continuous-integration.yml
-
-
Stage and commit the files:
git add composer.* .github/workflows/continuous-integration.yml && git commit -m 'Prepare for Renovate-Bot' -s
-
Create a pull request from your feature/renovate branch. If you are using the GitHub CLI, this can be done with:
gh pr create
If you have time and are able, we can take this same time to update the automatic-releases workflow to use the new reusable workflow. This can be done int he same feature/renovate branch, as part of the same pull request.
-
See if there are differences in the automatic-releases workflow:
$ diff -u --ignore-all-space \ <(curl -s https://raw.githubusercontent.com/laminas/laminas-eventmanager/9e11e32de9eb66451ddaba81d282cccb9bbf245f/.github/workflows/release-on-milestone-closed.yml) \ .github/workflows/release-on-milestone-closed.yml
-
If there ARE differences, DO NOTHING
-
If there ARE NOT differences, run the following:
$ echo 'name: "Automatic Releases" on: milestone: types: - "closed" jobs: release: uses: laminas/workflow-automatic-releases/.github/workflows/[email protected] secrets: GIT_AUTHOR_EMAIL: ${{ secrets.GIT_AUTHOR_EMAIL }} GIT_AUTHOR_NAME: ${{ secrets.GIT_AUTHOR_NAME }} ORGANIZATION_ADMIN_TOKEN: ${{ secrets.ORGANIZATION_ADMIN_TOKEN }} SIGNING_SECRET_KEY: ${{ secrets.SIGNING_SECRET_KEY }}' > .github/workflows/release-on-milestone-closed.yml
-
-
Stage and commit the files:
git add .github/workflows/release-on-milestone-closed.yml && git commit -m 'Update to reusable automatic-releases workflow' -s
-
Push the changes to your fork.