From 88015903555ef8365b8e0fae67db079d727c3965 Mon Sep 17 00:00:00 2001 From: Danny Staple Date: Sat, 11 May 2024 11:54:24 +0100 Subject: [PATCH] Potential release process --- .github/workflows/on_push_to_main_release.yml | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 .github/workflows/on_push_to_main_release.yml diff --git a/.github/workflows/on_push_to_main_release.yml b/.github/workflows/on_push_to_main_release.yml new file mode 100644 index 0000000..962bcf3 --- /dev/null +++ b/.github/workflows/on_push_to_main_release.yml @@ -0,0 +1,49 @@ +--- +on: + push: + branches: + - main + paths-ignore: + - '**/.gitignore' + - '**/.github/workflows/on_pr*' + - '**/.github/workflows/precommit_updates.yml' + - '**/.pre-commit-config.yaml' + +jobs: + bump: + ## Bump the version, depending on what was in the last push + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + # Scan the commit message for a prefix or major/minor. Otherwise default to patch + - name: Determine bump type + id: bump_type + run: | + commit_message="$(git log --format=%B -n 1 ${{ github.sha }})" + # if it starts with major:, minor:, or patch:, use that + if [[ $commit_message =~ ^(major|minor|patch): ]]; then + echo "bump_type=${BASH_REMATCH[1]}" >> "$GITHUB_OUTPUT" + else + echo "bump_type=${BASH_REMATCH[1]}" >> "$GITHUB_OUTPUT" + fi + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: 3.x + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install poetry + poetry install + + - name: Bump version + run: | + poetry version "${{ steps.bump_type.outputs.bump_type }}" + + # TODO: Needs tests... + # - name: poetry publish + # TODO: Sort out secrets