Skip to content

Downgraded Release #103

Downgraded Release

Downgraded Release #103

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
- '*'
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.2
coverage: none
# invoke patches
- run: composer install
# but no dev packages
- run: composer update --no-dev
# remove code-sniffer tests
- run: |
rm -rf vendor/phpcsstandards/php_codesniffer/tests/
rm -rf vendor/phpcsstandards/php_codesniffer/src/Standards/*/Tests/
# 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
# downgrade to PHP 7.2
- run: rector-local/vendor/bin/rector process bin config/config.php src vendor --config build/rector-downgrade-php-72.php --ansi
# verify PHP 7.2 compat
-
uses: "shivammathur/setup-php@v2"
with:
php-version: 7.2
coverage: none
- run: composer global require php-parallel-lint/php-parallel-lint --ansi
- run: /home/runner/.composer/vendor/bin/parallel-lint src vendor --exclude vendor/symfony/dependency-injection/Attribute/Autowire.php --exclude vendor/symfony/config/Definition/Dumper/XmlReferenceDumper.php --exclude vendor/symfony/console/Debug/CliRequest.php
# restore build php version
-
uses: "shivammathur/setup-php@v2"
with:
php-version: 8.2
coverage: none
# fix coding standard, so code looks nice
- run: bin/ecs check src --fix --ansi
# clear the dev files
- run: rm -rf tests ecs.php phpstan.neon phpunit.xml .gitignore .editorconfig
# prefix and scope
- run: sh prefix-code.sh
# copy PHP 7.2 composer + workflows
- run: cp -r build/target-repository/. .
# clear the dev files
- run: rm -rf build prefix-code.sh monorepo-builder.php full_ecs_build.sh easy-ci.php scoper.php rector.php
# setup git user
-
run: |
git config user.email "action@github.com"
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"
# force push tag, so there is only 1 version
git tag "${GITHUB_REF#refs/tags/}" --force
git push origin "${GITHUB_REF#refs/tags/}" --force