Skip to content

Make example app release PR #3

Make example app release PR

Make example app release PR #3

# Will create PR only if new version in root pubspec exists
name: Make example app release PR
on:
workflow_dispatch:
jobs:
pull-request-creation:
permissions:
pull-requests: write
contents: write
runs-on: ubuntu-latest
steps:
- name: Clone Repository
uses: actions/checkout@v4
- name: Read version from root pubspec.yaml
id: read_version
run: |
version=$(grep '^version:' pubspec.yaml | awk '{print $2}')
echo "Version found: $version"
echo "pubspec_version=$version" >> $GITHUB_OUTPUT
- name: Update version in example pubspec.yaml
run: |
sed -i "s/^version:.*/version: ${{ steps.read_version.pubspec_version }} # automatically set by GH Action /" example/pubspec.yaml
- uses: actions4git/setup-git@v1
name: Setup git
- name: Check for changes
id: check_changes
run: |
if [[ -n $(git status --porcelain) ]]; then
echo "has_changes=true" >> "$GITHUB_OUTPUT";
else
echo "has_changes=false" >> "$GITHUB_OUTPUT";
fi
- name: Create Pull Request
if: steps.check_changes.outputs.has_changes
uses: peter-evans/create-pull-request@v7
with:
commit-message: ${{ format('chore:\ Example app release v{0}', steps.read_version.pubspec_version) }}
branch: "chore/example-release"
title: ${{ format('Release example app v{0}', steps.read_version.pubspec_version) }}
body: |
Make changes for Example app release.
- Update pubspec
**Merging this PR will trigger the release into the enterprise app stores.**
labels: |
exampleAppRelease:pending
- name: No changes to commit
if: env.changes == 'false'
run: echo "No new version detected."