Skip to content

Bump version

Bump version #55

Workflow file for this run

name: Bump version
on:
workflow_dispatch:
inputs:
dbt-package-version:
type: string
required: true
description: New elementary package version
workflow_call:
inputs:
dbt-package-version:
type: string
required: true
jobs:
validate-version:
runs-on: ubuntu-latest
outputs:
validated-dbt-package-version: ${{ steps.validate-dbt-package-input.outputs.dbt-package-validation }}
steps:
- name: validate 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 "dbt package version: ${{ steps.validate-dbt-package-input.outputs.dbt-package-validation }}"
- name: fail on invalid input
if: ${{ steps.validate-dbt-package-input.outputs.dbt-package-validation == '' }}
uses: actions/github-script@v6
with:
script: |
core.setFailed("Invalid version input - ${{ inputs.dbt-package-version }}")
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/${{ inputs.dbt-package-version }}
- name: Initial config
run: |
git config user.name "GitHub Actions"
git config user.email [email protected]
- name: Bump package version
run: |
sed -i 's/version: "[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*"$/version: "${{ inputs.dbt-package-version }}"/' ./dbt_project.yml
- name: Bump readme package version
run: |
sed -i 's/version: [0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*$/version: ${{ inputs.dbt-package-version }}/' ./README.md
- name: Commit changes
run: git commit -am "release ${{ inputs.dbt-package-version }}"
- name: Push code
run: git push origin release/${{ inputs.dbt-package-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/${{ inputs.dbt-package-version }}"
destination_branch: "master"
pr_title: "release/${{ inputs.dbt-package-version }}"
pr_body: "Open automatically using bump version workflow"
github_token: ${{ secrets.GITHUB_TOKEN }}