Skip to content

Create release PR

Create release PR #8

name: Create release PR
on:
workflow_dispatch:
inputs:
version:
description: "The new version number. Example: 1.0.1"
required: true
type: string
jobs:
init_release:
name: 🚀 Create release PR
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Update version in composer.json and Constant.php
env:
VERSION: ${{ github.event.inputs.version }}
run: |
# Update composer.json
sed -i 's/"version": ".*"/"version": "v'$VERSION'"/' composer.json
# Update Constant.php (remove 'v' prefix for constant)
sed -i "s/const VERSION = '.*'/const VERSION = '$VERSION'/" src/Constant.php
git config --global user.name 'github-actions'
git config --global user.email 'release@getstream.io'
git checkout -q -b "release-$VERSION"
git add composer.json src/Constant.php
git commit -am "chore(release): $VERSION"
git push -q -u origin "release-$VERSION"
- name: Open pull request
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr create \
-t "Release ${{ github.event.inputs.version }}" \
-b "# :rocket: ${{ github.event.inputs.version }}
Make sure to use squash & merge when merging!
Once this is merged, another job will kick off automatically and publish the package.
## Changes
- Updated version in composer.json to v${{ github.event.inputs.version }}
- Updated version in Constant.php to ${{ github.event.inputs.version }}"