|
5 | 5 | tags:
|
6 | 6 | - '**'
|
7 | 7 |
|
| 8 | +env: |
| 9 | + COMPOSER_ROOT_VERSION: '1.x-dev' |
| 10 | + DEFAULT_BRANCH: '1.x' |
| 11 | + TARGET_PHP_VERSION: '7.4' |
| 12 | + TARGET_PHP_VERSION_ID: 70400 |
| 13 | + |
8 | 14 | jobs:
|
9 | 15 | build:
|
10 | 16 | name: Create a release
|
11 | 17 | runs-on: ubuntu-latest
|
| 18 | + |
12 | 19 | steps:
|
13 | 20 | - name: Checkout code
|
14 | 21 | uses: actions/checkout@v4
|
15 | 22 |
|
16 | 23 | - name: Create release
|
17 |
| - uses: actions/create-release@latest |
18 |
| - env: |
19 |
| - GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }} |
| 24 | + uses: crazy-max/ghaction-github-release@v2 |
20 | 25 | with:
|
21 |
| - tag_name: ${{ github.ref }} |
22 |
| - release_name: ${{ github.ref }} |
| 26 | + token: ${{ secrets.RELEASE_TOKEN }} |
23 | 27 | draft: true
|
24 | 28 | prerelease: false
|
| 29 | + |
| 30 | + build_downgraded_release: |
| 31 | + name: Build release for lower PHP version |
| 32 | + runs-on: ubuntu-latest |
| 33 | + needs: build |
| 34 | + timeout-minutes: 10 |
| 35 | + |
| 36 | + permissions: |
| 37 | + # Give the default GITHUB_TOKEN write permission to commit and push the |
| 38 | + # added or changed files to the repository. |
| 39 | + contents: write |
| 40 | + |
| 41 | + steps: |
| 42 | + - name: Checkout code |
| 43 | + uses: actions/checkout@v4 |
| 44 | + |
| 45 | + - name: Setup PHP 8.1 |
| 46 | + uses: shivammathur/setup-php@v2 |
| 47 | + with: |
| 48 | + php-version: '8.1' |
| 49 | + coverage: none |
| 50 | + env: |
| 51 | + COMPOSER_TOKEN: ${{ secrets.RELEASE_TOKEN }} |
| 52 | + |
| 53 | + - name: Get branch name |
| 54 | + id: branch_name |
| 55 | + run: echo "BRANCH=build-downgrade-to-${{ env.TARGET_PHP_VERSION_ID }}" >> $GITHUB_OUTPUT |
| 56 | + |
| 57 | + - name: Install dependencies |
| 58 | + run: composer update --ansi |
| 59 | + |
| 60 | + - name: Downgrade src |
| 61 | + run: php bin/transform-source ${{ env.TARGET_PHP_VERSION_ID }} |
| 62 | + |
| 63 | + - name: Setup PHP ${{ env.TARGET_PHP_VERSION }} |
| 64 | + uses: shivammathur/setup-php@v2 |
| 65 | + with: |
| 66 | + php-version: ${{ env.TARGET_PHP_VERSION }} |
| 67 | + coverage: none |
| 68 | + env: |
| 69 | + COMPOSER_TOKEN: ${{ secrets.RELEASE_TOKEN }} |
| 70 | + |
| 71 | + - name: Get tag for downgraded release |
| 72 | + id: tag-downgraded |
| 73 | + run: echo "${{ format('DOWNGRADED_TAG={0}.{1}', github.ref_name, env.TARGET_PHP_VERSION_ID) }}" >> $GITHUB_OUTPUT |
| 74 | + |
| 75 | + - name: Import GPG signing information |
| 76 | + uses: crazy-max/ghaction-import-gpg@v6 |
| 77 | + with: |
| 78 | + gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} |
| 79 | + passphrase: ${{ secrets.PASSPHRASE }} |
| 80 | + git_config_global: true |
| 81 | + git_user_signingkey: true |
| 82 | + git_commit_gpgsign: true |
| 83 | + git_tag_gpgsign: true |
| 84 | + |
| 85 | + - name: Commit and tag |
| 86 | + uses: stefanzweifel/git-auto-commit-action@v4 |
| 87 | + env: |
| 88 | + GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }} |
| 89 | + with: |
| 90 | + commit_message: 'Release PHPStan CodeIgniter to target PHP ${{ env.TARGET_PHP_VERSION }}' |
| 91 | + branch: ${{ steps.branch_name.outputs.BRANCH }} |
| 92 | + tagging_message: ${{ steps.tag-downgraded.outputs.DOWNGRADED_TAG }} |
| 93 | + commit_options: '--gpg-sign' |
| 94 | + commit_user_name: paulbalandan |
| 95 | + commit_user_email: [email protected] |
| 96 | + add_options: '-u' |
| 97 | + create_branch: true |
| 98 | + |
| 99 | + - name: Delete branch |
| 100 | + run: | |
| 101 | + git switch ${{ env.DEFAULT_BRANCH }} |
| 102 | + git branch -D ${{ steps.branch_name.outputs.BRANCH }} |
0 commit comments