apply rector #37
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: Downgraded Release | |
on: | |
push: | |
tags: | |
# avoid infinite looping, skip tags that ends with ".72" | |
# see https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#example-including-and-excluding-branches | |
- '*' | |
- '!**.72' | |
jobs: | |
downgrade_release: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: "actions/checkout@v3" | |
with: | |
token: ${{ secrets.WORKFLOWS_TOKEN }} | |
- | |
uses: "shivammathur/setup-php@v2" | |
with: | |
php-version: 8.1 | |
coverage: none | |
# invoke patches | |
- run: composer install --ansi | |
# but no dev packages | |
- run: composer update --no-dev --ansi | |
# get rector to "rector-local" directory, to avoid downgrading itself in the /vendor | |
- run: mkdir rector-local | |
- run: composer require rector/rector:^0.17.1 --working-dir rector-local --ansi | |
# downgrade to PHP 7.2 | |
- run: rector-local/vendor/bin/rector process src packages config --config build/rector-downgrade-php-72.php --ansi | |
# clear the dev files | |
- run: rm -rf tests packages-tests rector-local ecs.php phpstan.neon phpunit.xml .editorconfig | |
# copy PHP 7.2 composer + workflows | |
- run: cp -r build/target-repository/. . | |
# clear the dev files | |
- run: rm -rf build monorepo-builder.php full-tool-build.sh rector.php phpstan-for-tests.neon tests src-for-tests | |
# setup git user | |
- | |
run: | | |
git config user.email "[email protected]" | |
git config user.name "GitHub Action" | |
# publish to the same repository with a new tag | |
# see https://tomasvotruba.com/blog/how-to-release-php-81-and-72-package-in-the-same-repository/ | |
- | |
name: "Tag Downgraded Code" | |
run: | | |
# separate a "git add" to add untracked (new) files too | |
git add --all | |
git commit -m "release PHP 7.2 downgraded" | |
git tag "${GITHUB_REF#refs/tags/}.72" | |
git push origin "${GITHUB_REF#refs/tags/}.72" |