Skip to content

upgrade-cdktf

upgrade-cdktf #2005

Workflow file for this run

# ~~ Generated by projen. To modify, edit .projenrc.ts and run "npx projen".
name: upgrade-cdktf
on:
schedule:
- cron: 11 */6 * * *
workflow_dispatch: {}
concurrency:
group: ${{ 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@11bd71901bbe5b1630ceea73d27597364c9af683
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af
with:
node-version: 20.9.0
- name: Install
run: yarn install
- name: Get current CDKTF version
id: current_version
run: |-
OLD_VERSION=$(sed -nE 's/default: "(0..*)",/\1/p' .projenrc.ts | xargs)
OLD_VERSION_MINOR=$(cut -d "." -f 2 <<< "$OLD_VERSION")
echo "value=$OLD_VERSION" >> $GITHUB_OUTPUT
echo "minor=$OLD_VERSION_MINOR" >> $GITHUB_OUTPUT
- name: Get latest CDKTF version
id: latest_version
run: |-
CDKTF_VERSION=$(yarn info cdktf --json | jq -r '.data.version')
CDKTF_VERSION_MINOR=$(cut -d "." -f 2 <<< "$CDKTF_VERSION")
CONSTRUCTS_VERSION=$(yarn info cdktf --json | jq -r '.data.peerDependencies.constructs')
CONSTRUCTS_VERSION_EXACT=$(cut -d "^" -f 2 <<< "$CONSTRUCTS_VERSION")
echo "value=$CDKTF_VERSION" >> $GITHUB_OUTPUT
echo "minor=$CDKTF_VERSION_MINOR" >> $GITHUB_OUTPUT
echo "constructs=$CONSTRUCTS_VERSION_EXACT" >> $GITHUB_OUTPUT
- name: Run upgrade script
if: steps.current_version.outputs.value != steps.latest_version.outputs.value
run: scripts/update-cdktf.sh ${{ steps.latest_version.outputs.value }} ${{ steps.latest_version.outputs.constructs }}
- name: Get the latest version of this GitHub Action from git
id: github_action
if: steps.current_version.outputs.minor != steps.latest_version.outputs.minor
run: echo "version=$(git describe --tags | cut -d "-" -f 1)" >> $GITHUB_OUTPUT
- name: Update the README for a breaking change
if: steps.current_version.outputs.minor != steps.latest_version.outputs.minor
env:
GHA_VERSION: ${{ steps.github_action.outputs.version }}
run: |-
GHA_VERSION_MAJOR=$(cut -d "." -f 1 <<< "$GHA_VERSION" | cut -c2-)
NEW_GHA_VERSION=$((GHA_VERSION_MAJOR+1))
sed -i 's/terraform-cdk-action@v.*/terraform-cdk-action@v'"$NEW_GHA_VERSION"'/' "./README.md"
- name: Create pull request for a breaking change
if: steps.current_version.outputs.minor != steps.latest_version.outputs.minor
uses: peter-evans/create-pull-request@67ccf781d68cd99b580ae25a5c18a1cc84ffff1f
with:
branch: auto/upgrade-cdktf-${{ steps.latest_version.outputs.minor }}
base: main
labels: automerge,dependencies
token: ${{ secrets.PROJEN_GITHUB_TOKEN }}
author: team-tf-cdk <github-team-tf-cdk@hashicorp.com>
committer: team-tf-cdk <github-team-tf-cdk@hashicorp.com>
signoff: true
delete-branch: true
commit-message: "chore!: change default CDKTF version to ${{ steps.latest_version.outputs.value }}"
title: "chore!: change default CDKTF version to ${{ steps.latest_version.outputs.value }}"
body: |-
This PR increases the default version of CDKTF used from `${{ steps.current_version.outputs.value }}` to version `${{ steps.latest_version.outputs.value }}`.
This is considered a breaking change because anyone who does not manually specify a `cdktfVersion` in their action configuration will automatically start using the new version.
- name: Create pull request for a non-breaking change
if: steps.current_version.outputs.minor == steps.latest_version.outputs.minor
uses: peter-evans/create-pull-request@67ccf781d68cd99b580ae25a5c18a1cc84ffff1f
with:
branch: auto/upgrade-cdktf-${{ steps.latest_version.outputs.minor }}
base: main
labels: automerge,dependencies,auto-approve
token: ${{ secrets.PROJEN_GITHUB_TOKEN }}
author: team-tf-cdk <github-team-tf-cdk@hashicorp.com>
committer: team-tf-cdk <github-team-tf-cdk@hashicorp.com>
signoff: true
delete-branch: true
commit-message: "fix: change default CDKTF version to ${{ steps.latest_version.outputs.value }}"
title: "fix: change default CDKTF version to ${{ steps.latest_version.outputs.value }}"
body: |-
This PR increases the default version of CDKTF used from `${{ steps.current_version.outputs.value }}` to version `${{ steps.latest_version.outputs.value }}`.
This is not considered a breaking change because it's just a patch release that shouldn't have any backwards incompatibilities.