upgrade-cdktf #350
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
# ~~ Generated by projen. To modify, edit .projenrc.ts and run "npx projen". | |
name: upgrade-cdktf | |
on: | |
schedule: | |
- cron: 49 */6 * * * | |
workflow_dispatch: {} | |
concurrency: ${{ github.workflow }}-${{ github.ref }} | |
jobs: | |
upgrade: | |
name: Upgrade CDKTF | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
env: | |
CI: "true" | |
CHECKPOINT_DISABLE: "1" | |
steps: | |
- name: Checkout | |
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 | |
- name: Install | |
run: yarn install | |
- name: Install examples | |
run: ls -d examples/* | xargs -I {} bash -c "cd '{}' && yarn" | |
- name: Get current CDKTF version | |
id: current_version | |
run: |- | |
OLD_VERSION=$(cd examples/hybrid-module && npm list cdktf --depth=0 --json | jq -r '.dependencies.cdktf.version') | |
OLD_VERSION_SHORT=$(cut -d "." -f 2 <<< "$OLD_VERSION") | |
echo "value=$OLD_VERSION" >> $GITHUB_OUTPUT | |
echo "short=$OLD_VERSION_SHORT" >> $GITHUB_OUTPUT | |
- name: Get latest CDKTF version | |
id: latest_version | |
run: |- | |
CDKTF_VERSION=$(yarn info cdktf --json | jq -r '.data.version') | |
CDKTF_VERSION_SHORT=$(cut -d "." -f 2 <<< "$CDKTF_VERSION") | |
echo "value=$CDKTF_VERSION" >> $GITHUB_OUTPUT | |
echo "short=$CDKTF_VERSION_SHORT" >> $GITHUB_OUTPUT | |
- name: Run upgrade script | |
if: steps.current_version.outputs.short != steps.latest_version.outputs.short | |
run: scripts/update-cdktf.sh ${{ steps.latest_version.outputs.value }} | |
- name: Check if there are any changes | |
id: get_changes | |
run: echo "changed=$(git status --porcelain | wc -l)" >> $GITHUB_OUTPUT | |
- name: Create draft pull request | |
if: steps.get_changes.outputs.changed != 0 | |
uses: peter-evans/create-pull-request@153407881ec5c347639a548ade7d8ad1d6740e38 | |
with: | |
commit-message: "chore!: upgrade to cdktf ${{ steps.latest_version.outputs.value }}" | |
branch: auto/upgrade-cdktf-${{ steps.latest_version.outputs.short }} | |
base: main | |
title: "chore!: upgrade to cdktf ${{ steps.latest_version.outputs.value }}" | |
body: |- | |
This PR initiates the upgrade of CDKTF from version `${{ steps.current_version.outputs.value }}` to version `${{ steps.latest_version.outputs.value }}`. | |
Unfortunately, not everything can be automated, and the following steps need to be completed manually: | |
- [ ] Update `@cdktf/tf-module-stack` to a version compatible with `cdktf@${{ steps.latest_version.outputs.value }}` [here](https://github.com/cdktf/projen-cdktf-hybrid-construct/blob/62c33dca3eaa249b519edd82fa0889ffcd12c6eb/src/hybrid-module.ts#L194). Look up the version [here](https://www.npmjs.com/package/@cdktf/tf-module-stack?activeTab=versions). | |
- [ ] Run `npx projen build` | |
Please checkout this PR, complete the above steps, push the changes to this branch, and then mark this PR as ready for review to complete the upgrade. Thanks! | |
labels: automerge,auto-approve,dependencies | |
token: ${{ secrets.PROJEN_GITHUB_TOKEN }} | |
author: team-tf-cdk <[email protected]> | |
committer: team-tf-cdk <[email protected]> | |
signoff: true | |
delete-branch: true | |
draft: true |