Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 51 additions & 29 deletions .github/workflows/downgraded_release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,62 +2,84 @@ name: Downgraded Release

on:
push:
branches:
- main
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"
- uses: "actions/checkout@v5"
with:
token: ${{ secrets.WORKFLOWS_TOKEN }}
token: ${{ secrets.WORKFLOWS_TOKEN || github.token }}

-
uses: "shivammathur/setup-php@v2"
with:
php-version: 8.2
php-version: 8.4
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:^1.1 --working-dir rector-local --ansi
# downgrade /src to PHP 7.4
- run: vendor/bin/rector process src --config build/rector-downgrade-php-74.php --ansi
- run: vendor/bin/ecs check src --fix --ansi

# downgrade to PHP 7.4
- run: rector-local/vendor/bin/rector process src --config build/rector-downgrade-php-74.php --ansi
# clear the dev files, the vendor is not shipped as this is a phpstan extension
- run: rm -rf vendor tests ecs.php phpstan.neon phpunit.xml rector.php composer.lock .gitignore .editorconfig full-tool-build.sh

# clear the dev files
- run: rm -rf tests rector-local ecs.php phpstan.neon phpunit.xml .editorconfig
# remove the original .github, to fully override it with the target repository one below
- run: rm -rf .github

# copy PHP 7.2 composer + workflows
# copy PHP 7.4 composer + workflows
- run: cp -r build/target-repository/. .

# clear the dev files
- run: rm -rf build full-tool-build.sh rector.php phpstan-for-tests.neon tests
# clear the build files
- run: rm -rf build

# 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@v5"
with:
repository: anywherephp/type-perfect
path: remote-repository
token: ${{ secrets.WORKFLOWS_TOKEN }}

# remove remote files, to avoid piling up dead code in remote repository
- run: rm -rf remote-repository/src remote-repository/config 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 "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/
git config user.email "tomas@getrector.org"
git config user.name "rector-bot"

# publish to remote repository without tag
-
name: "Tag Downgraded Code"
name: "Push Downgraded Code - branch"
working-directory: remote-repository
if: "!startsWith(github.ref, 'refs/tags/')"
run: |
# separate a "git add" to add untracked (new) files too
git add --all
git commit -m "release PHP 7.4 downgraded"
git commit -m "Updated TypePerfect to commit ${{ github.event.after }}"
git push --quiet origin main

# force push tag, so there is only 1 version
git tag "${GITHUB_REF#refs/tags/}" --force
git push origin "${GITHUB_REF#refs/tags/}" --force
# 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 "TypePerfect ${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/}"
3 changes: 0 additions & 3 deletions build/target-repository/.github/FUNDING.yml

This file was deleted.

23 changes: 23 additions & 0 deletions build/target-repository/.github/workflows/auto_closer.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Auto Closer PR

on:
pull_request_target:
types: [opened]

jobs:
run:
runs-on: ubuntu-latest
steps:
- uses: superbrothers/close-pull-request@v3
with:
# Optional. Post a issue comment just before closing a pull request.
comment: |
Hi, thank you for your contribution.

Unfortunately, this repository is read-only. It's a build of the main repository.

We'd like to kindly ask you to move the contribution there - https://github.com/rectorphp/type-perfect.

We'll check it, review it and give you feed back right way.

Thank you.
22 changes: 0 additions & 22 deletions build/target-repository/.github/workflows/standalone_install.yaml

This file was deleted.

3 changes: 3 additions & 0 deletions build/target-repository/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Type Perfect - Anywhere version

See original repository for more details: https://github.com/rectorphp/type-perfect
4 changes: 2 additions & 2 deletions build/target-repository/composer.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "rector/type-perfect",
"name": "anywherephp/type-perfect",
"type": "phpstan-extension",
"description": "Next level type declaration checks",
"license": "MIT",
"license": "proprietary",
"require": {
"php": "^7.4|^8.0",
"phpstan/phpstan": "^2.1.14",
Expand Down
9 changes: 0 additions & 9 deletions build/target-repository/phpstan-for-tests.neon

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
use Rector\TypePerfect\Printer\CollectorMetadataPrinter;

/**
* @implements Collector<ClassMethod, array{class-string, string, string, int}|null>
* @implements Collector<ClassMethod, array{class-string, string, string, int}>
*/
final readonly class PublicClassMethodParamTypesCollector implements Collector
{
Expand Down
2 changes: 1 addition & 1 deletion src/Collector/MethodCall/MethodCallArgTypesCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
use Rector\TypePerfect\ValueObject\MethodCallReference;

/**
* @implements Collector<MethodCall, array<string>|null>
* @implements Collector<MethodCall, array{string, string}>
*/
final readonly class MethodCallArgTypesCollector implements Collector
{
Expand Down
Loading