Skip to content

Bump version

Bump version #54

Workflow file for this run

name: Bump version
on:
workflow_dispatch:
inputs:
cli-version:
type: string
required: true
description: New cli version
dbt-package-version:
type: string
required: false
description: Elementary package version (will use cli version if not provided)
workflow_call:
inputs:
cli-version:
type: string
required: true
dbt-package-version:
type: string
required: false
jobs:
validate-version:
runs-on: ubuntu-latest
outputs:
validated-cli-version: ${{ steps.validate-cli-input.outputs.cli-validation }}
default-dbt-package-version: ${{ steps.validate-cli-input.outputs.cli-validation }}
validated-dbt-package-version: ${{ steps.validate-dbt-package-input.outputs.dbt-package-validation }}
steps:
- name: validate cli version input
id: validate-cli-input
run: echo "cli-validation=$(echo ${{ inputs.cli-version }} | sed -n '/^[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*$/p')" >> $GITHUB_OUTPUT
- name: validate dbt package version
if: ${{ inputs.dbt-package-version }}
id: validate-dbt-package-input
run: echo "dbt-package-validation=$(echo ${{ inputs.dbt-package-version }} | sed -n '/^[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*$/p')" >> $GITHUB_OUTPUT
- name: echo versions
run: |
echo "cli version: ${{ steps.validate-cli-input.outputs.cli-validation }}"
echo "dbt package version: ${{ steps.validate-dbt-package-input.outputs.dbt-package-validation }}"
- name: fail on invalid input
if: ${{ steps.validate-cli-input.outputs.cli-validation == '' }}
uses: actions/github-script@v6
with:
script: |
core.setFailed("Invalid version inputs")
bump-version:
needs: validate-version
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Create release branch
run: git checkout -b release/v${{ inputs.cli-version }}
- name: Initial config
run: |
git config user.name "GitHub Actions"
git config user.email [email protected]
- name: Bump version
run: |
sed -i 's/^version = "[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*"/version = "${{ inputs.cli-version }}"/' ./pyproject.toml
- name: Bump version for package (using input)
if: ${{ needs.validate-version.outputs.validated-dbt-package-version != ''}}
run: |
sed -i 's/version: [0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*$/version: ${{ needs.validate-version.outputs.validated-dbt-package-version }}/' ./elementary/monitor/dbt_project/packages.yml
sed -i 's/version: [0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*$/version: ${{ needs.validate-version.outputs.validated-dbt-package-version }}/' ./docs/_snippets/quickstart-package-install.mdx
- name: Bump version for package (using default)
if: ${{ needs.validate-version.outputs.validated-dbt-package-version == ''}}
run: |
sed -i 's/version: [0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*$/version: ${{ needs.validate-version.outputs.default-dbt-package-version }}/' ./elementary/monitor/dbt_project/packages.yml
sed -i 's/version: [0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*$/version: ${{ needs.validate-version.outputs.default-dbt-package-version }}/' ./docs/_snippets/quickstart-package-install.mdx
- name: Commit changes
run: git commit -am "release v${{ inputs.cli-version }}"
- name: Push code
run: git push origin release/v${{ inputs.cli-version }}
create-pr:
needs: bump-version
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: create pull request
uses: repo-sync/pull-request@v2
with:
source_branch: "release/v${{ inputs.cli-version }}"
destination_branch: "master"
pr_title: "release/v${{ inputs.cli-version }}"
pr_body: "Open automatically using bump version workflow"
github_token: ${{ secrets.GITHUB_TOKEN }}