Skip to content

bump_cli_version

bump_cli_version #32

name: Bump CLI version info
on:
workflow_dispatch:
repository_dispatch:
types: [ bump_cli_version ]
jobs:
bump-cli:
name: Bump CLI version info
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Download latest releases.json
run: |
curl https://api.github.com/repos/infracost/infracost/releases -o ./static/releases.json
git add ./static/releases.json
echo "latest_version=$(jq .[0].name static/releases.json | sed s/v//)" >> $GITHUB_ENV
- name: Find/replace lastest CLI version references
run: |
find docs -name '*.md' -print0 | xargs -0 \
sed -r -i "s/infracost --version # Should show [[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+/infracost --version # Should show ${{ env.latest_version }}/g"
git --no-pager diff -R
- name: Create pull request
env:
GH_TOKEN: ${{ github.token }}
run: |
git config user.email "[email protected]"
git config user.name "tim775"
git add .
git checkout -b chore/bump_to_release_${{ env.latest_version }}
git commit -m "chore: bump to latest CLI version"
git push --set-upstream origin chore/bump_to_release_${{ env.latest_version }}
gh pr create -r tim775 --title="chore: Bump to cli version ${{ env.latest_version }}" --body="Autogenerated by CLI release workflow."