Uprev to version 0.42.0 #14
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Check Changelog | |
on: | |
pull_request: | |
paths: | |
- 'pyproject.toml' | |
- 'HISTORY.md' | |
jobs: | |
check-changelog: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 2 | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.12" | |
- name: Install dependencies and check for file changes | |
run: | | |
for file in pyproject.toml HISTORY.md; do | |
base_name=$(basename $file .${file##*.}) | |
if git diff --name-only HEAD^ | grep -q "^$file$"; then | |
echo "${base_name}_changed=true" >> $GITHUB_ENV | |
else | |
echo "${base_name}_changed=false" >> $GITHUB_ENV | |
fi | |
done | |
- name: Verify version change and HISTORY.md update | |
if: env.pyproject_changed == 'true' | |
run: | | |
VERSION_BEFORE=$(git show HEAD^:pyproject.toml | python -c "import tomllib, sys; print(tomllib.loads(sys.stdin.read())['project']['version'])") | |
VERSION_AFTER=$(python -c "import tomllib; print(tomllib.load(open('pyproject.toml', 'rb'))['project']['version'])") | |
if [ "$VERSION_BEFORE" != "$VERSION_AFTER" ] && [ "$history_changed" == "false" ]; then | |
echo "Version changed in pyproject.toml but no changes in HISTORY.md" | |
exit 1 | |
elif [ "$VERSION_BEFORE" != "$VERSION_AFTER" ] && [ "$history_changed" == "true" ]; then | |
echo "Version changed and HISTORY.md updated." | |
else | |
echo "Version did not change. Changes to HISTORY.md not required." | |
fi | |
- name: No changes detected | |
if: env.pyproject_changed == 'false' && env.history_changed == 'false' | |
run: echo "No changes detected in pyproject.toml or HISTORY.md. Everything is fine." |