Chore: Increase version (#72) #30
Workflow file for this run
This file contains 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: 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@v4 | |
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.2 | |
- name: Checkout Code | |
uses: actions/checkout@v2 | |
- 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: 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.3', '7.4', '8.0', '8.1'] | |
steps: | |
- name: Extract Version Name | |
id: extract_name | |
uses: actions/github-script@v4 | |
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.2 | |
- name: Checkout Code | |
uses: actions/checkout@v2 | |
- 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: Update composer.json version | |
run: 'sed -i -e ''s/"php": "\^8.2"/"php": "\^${{ matrix.version }}"/'' 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@v4 | |
with: | |
result-encoding: string | |
script: | | |
return context.payload.ref.replace(/refs\/tags\/release-/, ''); | |
- name: Checkout Code | |
uses: actions/checkout@v2 | |
- name: Delete original tag | |
env: | |
VERSION: ${{ steps.extract_name.outputs.result }} | |
run: git push origin --delete release-$VERSION |