Skip to content

Create dependabot.yml #14

Create dependabot.yml

Create dependabot.yml #14

Workflow file for this run

name: Versioning Workflow
on:
push:
branches:
- main
jobs:
determine-version:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
fetch-depth: "0"
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.11
- name: Install and Configure Poetry & Git Credentials
run: |
python -m pip install poetry==1.8.2
python -m poetry config virtualenvs.in-project true
- name: Cache the virtualenv
uses: actions/cache@v4
with:
path: ./.venv
key: ${{ runner.os }}-venv-${{ hashFiles('**/poetry.lock') }}
- name: Install dependencies
run: python -m poetry install
- name: Install GitHub CLI
env: # Or as an environment variable
RELEASE_TOKEN: ${{ secrets.RELEASE_TOKEN }}
run: |
echo $RELEASE_TOKEN > token.txt
gh auth login --with-token < token.txt
- name: Analyze Commit Messages and Bump Version
run: |
# Custom script to analyze commit messages and determine version bump
## Stored in .github/get_version_bump_type.py
## Assuming the script outputs the determined version bump as 'patch', 'minor', or 'major'
## Only None if there is no relevant commits.
version_bump=$(python .github/get_version_bump_type.py)
# Custom script to retrieve commit messages for release
## Stored in .github/valid_git_history.py
valid_git_history=$(python .github/valid_git_history.py)
if [ "$version_bump" == "patch" ]; then
poetry version patch
elif [ "$version_bump" == "minor" ]; then
poetry version minor
elif [ "$version_bump" == "major" ]; then
poetry version major
else
echo "Invalid version bump type ($version_bump). Skipping."
exit 0
fi
# Commit the version change to pyproject.toml
git add pyproject.toml
git config --global user.email "[email protected]"
git config --global user.name "Github Action Runner"
git commit -m "chore: Bump version ($version_bump)"
git push origin main
# Tag the commit with the new version
git tag $(poetry version -s)
git push origin $(poetry version -s)
# Create a release
gh release create $(poetry version -s) -t "Release $(poetry version -s)" -n "$valid_git_history"