Skip to content

Chore: Increase version (#208) #88

Chore: Increase version (#208)

Chore: Increase version (#208) #88

Workflow file for this run

name: Create Release
concurrency: release
on:
push:
tags:
- release-*
workflow_dispatch:
jobs:
release_latest:
name: Release latest PHP version
runs-on: ubuntu-latest
steps:
- name: Extract Version Name
id: extract_name
uses: actions/github-script@v7
with:
result-encoding: string
script: |
return context.payload.ref.replace(/refs\/tags\/release-/, '');
- name: Checkout Code
uses: actions/checkout@v4
- name: Check if version is updated in SDK
env:
VERSION: ${{ steps.extract_name.outputs.result }}
run: php tests/check-version.php $VERSION
- name: Create latest release tag
env:
VERSION: ${{ steps.extract_name.outputs.result }}
run: git tag v${VERSION}82
- name: Push latest release tag
env:
VERSION: ${{ steps.extract_name.outputs.result }}
run: git push origin v${VERSION}82
release_older:
name: Release older PHP version
runs-on: ubuntu-latest
strategy:
matrix:
version: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2']
steps:
- name: Extract Version Name
id: extract_name
uses: actions/github-script@v7
with:
result-encoding: string
script: |
return context.payload.ref.replace(/refs\/tags\/release-/, '');
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.3
- name: Checkout Code
uses: actions/checkout@v4
- name: Install Dependencies
run: composer install
- name: Check if version is updated in SDK
env:
VERSION: ${{ steps.extract_name.outputs.result }}
run: php tests/check-version.php $VERSION
- name: Transpile ${{ matrix.version }}
run: php vendor/bin/rector process --no-diffs --no-progress-bar --config rector.$(echo ${{ matrix.version }} | sed -e 's/\.//').php src
- name: Add polyfill for 7.3
if: matrix.version == '7.2'
run: composer require symfony/polyfill-php73:^1.0
- name: Update composer.json version
run: 'sed -i -e ''s/"php": "\^8.3"/"php": "\^${{ matrix.version }}"/'' composer.json'
- name: Downgrade phpunit
if: matrix.version == '7.2'
run: 'sed -i -e ''s/"phpunit\/phpunit": "\^9.5"/"phpunit\/phpunit": "\^8.5"/'' composer.json'
- name: Copy Bootstrap
if: matrix.version == '7.2'
run: cp .github/bootstrap-72.php src
- name: Load Bootstrap
if: matrix.version == '7.2'
run: 'cat composer.json | jq --argjson files ''["src/bootstrap-72.php"]'' ''.autoload += {files: $files}'' > tmp.json && mv tmp.json composer.json'
- name: Commit PHP ${{ matrix.version }} version
run: |
git config --global --add safe.directory /github/workspace && \
git config user.email [email protected] && \
git config user.name "GitHub Actions" && \
git checkout -b tmp-php-${{ matrix.version }}-release && \
git add . -v && \
git commit -m "Transpile to PHP ${{ matrix.version }}" && \
git push origin tmp-php-${{ matrix.version }}-release
- name: Create PHP ${{ matrix.version }} release tag
env:
VERSION: ${{ steps.extract_name.outputs.result }}
run: git tag v${VERSION}$(echo ${{ matrix.version }} | sed -e 's/\.//')
- name: Push PHP ${{ matrix.version }} release tag
env:
VERSION: ${{ steps.extract_name.outputs.result }}
run: git push origin v${VERSION}$(echo ${{ matrix.version }} | sed -e 's/\.//')
- name: Delete temporary branch
run: git push origin --delete tmp-php-${{ matrix.version }}-release
delete_tag:
name: Delete original tag
runs-on: ubuntu-latest
needs:
- release_latest
- release_older
steps:
- name: Extract Version Name
id: extract_name
uses: actions/github-script@v7
with:
result-encoding: string
script: |
return context.payload.ref.replace(/refs\/tags\/release-/, '');
- name: Checkout Code
uses: actions/checkout@v4
- name: Delete original tag
env:
VERSION: ${{ steps.extract_name.outputs.result }}
run: git push origin --delete release-$VERSION