-
-
Notifications
You must be signed in to change notification settings - Fork 201
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
02c8ce1
commit 07f4de0
Showing
1 changed file
with
79 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
# yaml-language-server: $schema=https://github.com/SchemaStore/schemastore/blob/master/src/schemas/json/github-workflow.json | ||
name: Upgrade | ||
|
||
on: | ||
push: | ||
branches: | ||
- chore/release-workflow | ||
workflow_dispatch: ~ | ||
|
||
jobs: | ||
upgrade: | ||
name: Upgrade | ||
if: ${{ github.repository == 'api-platform/demo' }} | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
pull-requests: write | ||
steps: | ||
- | ||
name: Checkout | ||
uses: actions/checkout@v4 | ||
- | ||
name: Setup PHP with Composer | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
tools: composer | ||
- | ||
name: Get Composer Cache Directory | ||
id: composer-cache | ||
working-directory: api | ||
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | ||
- | ||
name: Cache Dependencies | ||
uses: actions/cache@v4 | ||
with: | ||
path: ${{ steps.composer-cache.outputs.dir }} | ||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | ||
restore-keys: ${{ runner.os }}-composer- | ||
- | ||
name: Update API Platform Dependencies | ||
working-directory: api | ||
run: composer update "api-platform/*" --no-install --no-scripts | ||
- | ||
name: Calculate Diff | ||
working-directory: api | ||
id: diff | ||
run: | | ||
echo "from-version=$(git diff composer.lock | grep -m 1 "api-platform/*" -A 2 | grep -oP '^-\s*"version": "v(.*)",' | sed -e 's/^-\s*"version": "v\(.*\)",$/\1/')" >> $GITHUB_OUTPUT | ||
echo "to-version=$(git diff composer.lock | grep -m 1 "api-platform/*" -A 2 | grep -oP '^\+\s*"version": "v(.*)",' | sed -e 's/^\+\s*"version": "v\(.*\)",$/\1/')" >> $GITHUB_OUTPUT | ||
- | ||
name: Update API version | ||
if: steps.diff.outputs.to-version != '' | ||
run: | | ||
sed -i "s/version: .*/version: ${{ steps.diff.outputs.to-version }}/g" api/config/packages/api_platform.yaml | ||
sed -i "s/^version: .*/version: ${{ steps.diff.outputs.to-version }}/g" helm/api-platform/Chart.yaml | ||
sed -i "s/^appVersion: .*/appVersion: ${{ steps.diff.outputs.to-version }}/g" helm/api-platform/Chart.yaml | ||
- | ||
name: Create Pull Request | ||
uses: peter-evans/create-pull-request@v7 | ||
if: steps.diff.outputs.to-version != '' | ||
with: | ||
token: ${{ secrets.API_PLATFORM_DEMO_PR_TOKEN }} | ||
branch: release/api-platform-${{ steps.diff.outputs.to-version }} | ||
base: ${{ github.event.repository.default_branch }} | ||
commit-message: "chore: upgrade API Platform to ${{ steps.diff.outputs.to-version }}" | ||
sign-commits: true | ||
title: "chore: upgrade API Platform to ${{ steps.diff.outputs.to-version }}" | ||
body: | | ||
Upgrade API Platform components to ${{ steps.diff.outputs.to-version }}. | ||
Update API version to ${{ steps.diff.outputs.to-version }}. | ||
Update Chart version to ${{ steps.diff.outputs.to-version }}. | ||
labels: dependencies | ||
assignees: vincentchalamon | ||
add-paths: | | ||
api/composer.* | ||
api/config/packages/api_platform.yaml | ||
helm/api-platform/Chart.yaml |