Skip to content

CD Release

CD Release #40

Workflow file for this run

name: CD Release
on:
workflow_dispatch:
inputs:
releaseVersion:
description: 'Semantic version of the release'
required: true
target_branch:
description: "The branch to release from"
type: string
required: true
jobs:
cdRelease:
runs-on: ubuntu-latest
name: Release
steps:
- uses: actions/checkout@v2
with:
token: ${{ secrets.GH_TOKEN }}
ref: ${{ inputs.target_branch }}
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements_dev.txt
- name: Bump version
shell: bash
run: |
git checkout -b releases/$RELEASE_VERSION
git config --global user.email "[email protected]"
git config --global user.name "Teradata GitHub Actions"
bumpversion --tag --commit --new-version $RELEASE_VERSION num
git push --set-upstream origin releases/$RELEASE_VERSION
git push --tags
env:
RELEASE_VERSION: ${{ github.event.inputs.releaseVersion }}
- name: Upload to PyPi
shell: bash
run: |
rm -fr dist/*
python setup.py sdist bdist_wheel
twine upload dist/*
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
with:
tag_name: v${{ github.event.inputs.releaseVersion }}
release_name: dbt-teradata v${{ github.event.inputs.releaseVersion }}
body_path: ./CHANGELOG.md
draft: false
prerelease: false
- name: reset changelog
shell: bash
run: |
git checkout $BRANCH_NAME
cp CHANGELOG.md.template CHANGELOG.md
git add CHANGELOG.md
git commit -m "resetting CHANGELOG.md for the next release"
git push
env:
BRANCH_NAME: ${{ inputs.target_branch }}
- name: changing dockerfile version
shell: bash
run: |
git checkout $BRANCH_NAME
sed -i "48s/.*/RUN python -m pip install dbt-teradata==$RELEASE_VERSION/g" docker/Dockerfile
if [[ "$RELEASE_VERSION" == "1.8"* ]] || [[ "$RELEASE_VERSION" > "1.8" ]]; then
if ! grep -q "RUN python -m pip install dbt-core>=1.8.0" docker/Dockerfile; then
echo "RUN python -m pip install dbt-core>=1.8.0" >> docker/Dockerfile
fi
fi
git add docker/Dockerfile
git commit -m "syncing version in Docker file"
git push
env:
RELEASE_VERSION: ${{ github.event.inputs.releaseVersion }}
BRANCH_NAME: ${{ inputs.target_branch }}