Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Workflow upgrade projenrc #83

Draft
wants to merge 14 commits into
base: main
Choose a base branch
from
Draft
92 changes: 92 additions & 0 deletions .github/workflows/upgrade-cdk-version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
name: upgrade-cdk-version
on:
workflow_dispatch: {}
schedule:
- cron: 0 2 * * *
push:
branches:
- "workflow-upgrade-projenrc"
jobs:
upgrade:
name: Upgrade
runs-on: ubuntu-latest
permissions:
contents: read
outputs:
patch_created: ${{ steps.create_patch.outputs.patch_created }}
steps:
- name: Checkout
uses: actions/checkout@v3
# with:
# ref: main
- name: Setup Node.js
uses: actions/setup-node@v3
- name: Upgrade cdk version
run: |-
CDK_LATEST=$( npm view aws-cdk version )
sed -E -i "s/(\/\* *workflow-upgrade-cdk-version *\*\/ *)'([0-9.]+)'( *\/\* *workflow-upgrade-cdk-version *\*\/)/\1'$CDK_LATEST'\3/g" .projenrc.ts
- name: Upgrade project
run: npx projen upgrade
- name: Find mutations
id: create_patch
run: |-
git add .
git diff --staged --patch --exit-code > .repo.patch || echo "patch_created=true" >> $GITHUB_OUTPUT
- name: Upload patch
if: steps.create_patch.outputs.patch_created
uses: actions/upload-artifact@v3
with:
name: .repo.patch
path: .repo.patch
pr:
name: Create Pull Request
needs: upgrade
runs-on: ubuntu-latest
# permissions:
# contents: read
if: ${{ needs.upgrade.outputs.patch_created }}
steps:
- name: Checkout
uses: actions/checkout@v3
# with:
# ref: main
- name: Download patch
uses: actions/download-artifact@v3
with:
name: .repo.patch
path: ${{ runner.temp }}
- name: Apply patch
run: '[ -s ${{ runner.temp }}/.repo.patch ] && git apply ${{ runner.temp }}/.repo.patch || echo "Empty patch. Skipping."'
- name: Set git identity
run: |-
git config user.name "github-actions"
git config user.email "[email protected]"
- name: Create Pull Request
id: create-pr
uses: peter-evans/create-pull-request@v4
with:
# token: ${{ secrets.PROJEN_GITHUB_TOKEN }}
commit-message: |-
chore(deps): upgrade cdk version

Upgrades project dependencies. See details in [workflow run].

[Workflow Run]: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}

------

*Automatically created via the "upgrade-cdk-version" workflow*
branch: github-actions/upgrade-cdk-version
title: "chore(deps): upgrade cdk version"
# labels: auto-approve
body: |-
Upgrades project dependencies. See details in [workflow run].

[Workflow Run]: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}

------

*Automatically created via the "upgrade-cdk-version" workflow*
author: github-actions <[email protected]>
committer: github-actions <[email protected]>
signoff: true
6 changes: 3 additions & 3 deletions .projen/deps.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions .projenrc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ SPDX-License-Identifier: Apache-2.0
import { CdklabsConstructLibrary } from 'cdklabs-projen-project-types';
import { Stability } from 'projen/lib/cdk';

const cdkVersion = '2.121.1';
const cdkVersion = /* workflow-upgrade-cdk-version */'2.121.0'/* workflow-upgrade-cdk-version */;

const project = new CdklabsConstructLibrary({
name: '@cdklabs/cdk-appflow',
author: 'Amazon Web Services',
Expand All @@ -32,4 +33,4 @@ const project = new CdklabsConstructLibrary({
'*.rest', '.vscode', '**/.DS_Store',
],
});
project.synth();
project.synth();
12 changes: 6 additions & 6 deletions package.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

46 changes: 23 additions & 23 deletions yarn.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading