bump version #66
This file contains hidden or 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: | |
| branches: | |
| - main | |
| tags: | |
| - '*' | |
| jobs: | |
| downgrade_release: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: "actions/checkout@v4" | |
| with: | |
| token: ${{ secrets.WORKFLOWS_TOKEN || github.token }} | |
| - | |
| uses: "shivammathur/setup-php@v2" | |
| with: | |
| php-version: 8.3 | |
| 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 --working-dir rector-local --ansi | |
| # downgrade to PHP 7.4 | |
| - run: rector-local/vendor/bin/rector process bin src vendor --config build/rector-downgrade-php.php --ansi | |
| # clear the dev files | |
| - run: rm -rf tests ecs.php phpstan.neon phpunit.xml .gitignore .editorconfig | |
| # prefix and scope | |
| - run: wget https://github.com/humbug/php-scoper/releases/download/0.18.19/php-scoper.phar --no-verbose | |
| - run: php -d memory_limit=-1 php-scoper.phar add-prefix bin src vendor composer.json --config scoper.php --force --ansi --output-dir scoped-code | |
| - run: | | |
| rm -r bin src vendor composer.json | |
| mv scoped-code/* . | |
| - run: composer dump-autoload --ansi --classmap-authoritative --no-dev | |
| - run: chmod 777 bin/behastan bin/behastan.php | |
| # remove the original .github, to fully override it with the target repository one below | |
| - run: rm -rf .github | |
| # copy PHP 7.4 composer + workflows | |
| - run: cp -r build/target-repository/. . | |
| # clear the dev files | |
| - run: rm -rf build scoper.php rector.php php-scoper.phar rector-local | |
| # clone the remote repository, so we can commit on top of its history and push without --force | |
| # inspired by https://github.com/easy-coding-standard/ecs-src/blob/main/.github/workflows/buid_release.yaml | |
| - | |
| uses: "actions/checkout@v4" | |
| with: | |
| repository: anywherephp/behastan | |
| path: remote-repository | |
| token: ${{ secrets.WORKFLOWS_TOKEN }} | |
| # remove remote files, to avoid piling up dead code in remote repository | |
| - run: rm -rf remote-repository/bin remote-repository/src remote-repository/vendor remote-repository/.github | |
| # copy the downgraded code to the remote repository | |
| - run: rsync -a --exclude .git --exclude remote-repository ./ remote-repository/ | |
| # setup git user | |
| - | |
| working-directory: remote-repository | |
| run: | | |
| git config user.email "tomas@getrector.org" | |
| git config user.name "rector-bot" | |
| # publish to remote repository without tag | |
| - | |
| name: "Push Downgraded Code - branch" | |
| working-directory: remote-repository | |
| if: "!startsWith(github.ref, 'refs/tags/')" | |
| run: | | |
| git add --all | |
| git commit -m "Updated Behastan to commit ${{ github.event.after }}" | |
| git push --quiet origin main | |
| # publish to remote repository with tag | |
| - | |
| name: "Push Downgraded Code - tag" | |
| working-directory: remote-repository | |
| if: "startsWith(github.ref, 'refs/tags/')" | |
| run: | | |
| git add --all | |
| git commit --allow-empty -m "Behastan ${GITHUB_REF#refs/tags/}" | |
| git push --quiet origin main | |
| git tag "${GITHUB_REF#refs/tags/}" -m "${GITHUB_REF#refs/tags/}" | |
| git push --quiet origin "${GITHUB_REF#refs/tags/}" |