Skip to content

upgrade-cdktf

upgrade-cdktf #1733

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@692973e3d937129bcbf40652eb9f2f61becf3332
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b
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")
echo "value=$CDKTF_VERSION" >> $GITHUB_OUTPUT
echo "minor=$CDKTF_VERSION_MINOR" >> $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 }}
- 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@c5a7806660adbe173f04e3e038b0ccdcd758773c
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@c5a7806660adbe173f04e3e038b0ccdcd758773c
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: "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.