Skip to content

Merge pull request #1540 from TeoZosa/dependabot/pip/docs/sphinx-7.3.7 #1431

Merge pull request #1540 from TeoZosa/dependabot/pip/docs/sphinx-7.3.7

Merge pull request #1540 from TeoZosa/dependabot/pip/docs/sphinx-7.3.7 #1431

Workflow file for this run

---
name: Release
on: # yamllint disable-line rule:truthy
push:
branches:
- main # forward-compatibility with new GitHub default branch naming
- master # backward-compatibility with old GitHub default branch naming
jobs:
# Shared tag & version number info ----------------------
get-tag-xor-dev-version:
name: Get tags and version numbers
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.detect-new-version-tag.outputs.tag }}
dev-version: ${{ steps.bump-dev-version.outputs.version }}
steps:
- name: Check out the repository
uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Set up Python
uses: actions/setup-python@v5.1.0
with:
python-version: "3.11"
- name: Upgrade pip
run: |
pip install --constraint=.github/workflows/constraints.txt pip
pip --version
- name: Install Poetry
run: |
pip install --constraint=.github/workflows/constraints.txt poetry
poetry --version
- name: Check if there is a parent commit
id: check-parent-commit
run: |
echo "sha=$(git rev-parse --verify --quiet HEAD^)" >> $GITHUB_OUTPUT
- name: Detect and tag new version
id: detect-new-version-tag
if: "steps.check-parent-commit.outputs.sha"
run: |
BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD)
git checkout HEAD~
PARENT_COMMIT_VER=$(make get-project-version-number)
git checkout "${BRANCH_NAME}"
CURRENT_COMMIT_VER=$(make get-project-version-number)
if [[ "${PARENT_COMMIT_VER}" != "${CURRENT_COMMIT_VER}" ]]; then
echo "tag=${CURRENT_COMMIT_VER}" >> $GITHUB_OUTPUT
fi
- name: Bump version for developmental release
id: bump-dev-version
if: "! steps.detect-new-version-tag.outputs.tag"
run: |
poetry version patch &&
VERSION=$(make get-project-version-number) &&
DEV_VERSION="${VERSION}.dev.$(date +%s)" &&
poetry version "${DEV_VERSION}" &&
echo "version=${DEV_VERSION}" >> $GITHUB_OUTPUT
# Release notes publication ----------------------
publish-release-notes:
name: Publish release notes
runs-on: ubuntu-latest
needs: get-tag-xor-dev-version
permissions:
pull-requests: write
contents: write
steps:
- name: Check out the repository
uses: actions/checkout@v4
- name: Publish the release notes
uses: release-drafter/release-drafter@v6.0.0
with:
publish: ${{ needs.get-tag-xor-dev-version.outputs.tag != '' }}
# Annotated tag to associate with the current commit
tag: ${{ needs.get-tag-xor-dev-version.outputs.tag }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}