-
Notifications
You must be signed in to change notification settings - Fork 4
67 lines (64 loc) · 3.33 KB
/
upgrade-cdktf.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# ~~ 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@b4ffde65f46336ab88eb53be808477a3936bae11
- 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