Skip to content

Bump to 2.39.0

Bump to 2.39.0 #73

Workflow file for this run

name: Publish On Tag
on:
push:
tags:
- 'v*'
jobs:
initial-checks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Only allow tags on master to be published
run: |
tag_commit=$(git rev-parse ${{ github.ref }})
master_commit=$(git rev-parse origin/master)
if [ "$tag_commit" = "$master_commit" ]; then
echo "The tag and master are pointing to the same commit."
else
echo "The tag ($tag_commit) and master ($master_commit) are not pointing to the same commit."
exit 1
fi
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pytest
- name: Run tests for Python ${{ matrix.python-version }} on ${{ matrix.os }}
run: |
pip install -e .
pytest
publish:
needs: [initial-checks, test]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.7
uses: actions/setup-python@v4
with:
python-version: 3.7
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install setuptools wheel twine
- name: Get module version
id: get_module_version
shell: bash
run: |
version=$(python -c "from auto_py_to_exe import __version__ as v; print(v)")
echo "Module version: $version"
echo "version=$version" >> $GITHUB_OUTPUT
- name: Fail on tag and module version mismatch
if: (!endsWith(github.ref, steps.get_module_version.outputs.version))
run: |
echo "Ref that triggered release: ${{ github.ref }}"
echo "Current module version: ${{ steps.get_module_version.outputs.version }}"
exit 1
- name: Get documented version changes from CHANGELOG.md
id: get_documented_changes
shell: python
run: |
import string
import os
import random
import re
with open("CHANGELOG.md", "r") as f:
changelog = f.read()
version = "${{ steps.get_module_version.outputs.version }}"
pattern = r"##\s*{}\s*\n((?:.|\n)*?)(?:\n##\s*|\Z)".format(re.escape(version))
changes = re.search(pattern, changelog).group(1).strip()
if changes == "":
print(f"Changes were not detected in CHANGELOG.md for version {version}")
exit(1)
footer = f"\n\n---\n\n[🌐 auto-py-to-exe {version} on PyPI](https://pypi.org/project/auto-py-to-exe/{version}/)"
changes += footer
print(changes)
# Writing multiline strings to output: https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#multiline-strings
github_output_file_path = os.getenv('GITHUB_OUTPUT')
delimiter = ''.join(random.choice(string.ascii_uppercase) for i in range(20))
with open(github_output_file_path, "a") as github_output_file:
github_output_file.write(f"changes<<{delimiter}\n{changes}\n{delimiter}")
- name: Build distribution
run: |
python setup.py sdist bdist_wheel --universal
- name: Publish package
uses: pypa/gh-action-pypi-publish@c7f29f7adef1a245bd91520e94867e5c6eedddcc
with:
user: __token__
password: ${{ secrets.pypi_password }}
- name: Create release
id: create_release
uses: softprops/action-gh-release@v1
with:
tag_name: v${{ steps.get_module_version.outputs.version }}
name: v${{ steps.get_module_version.outputs.version }}
draft: false
prerelease: false
body: ${{ steps.get_documented_changes.outputs.changes }}
files: |
./dist/auto_py_to_exe-${{ steps.get_module_version.outputs.version }}-py2.py3-none-any.whl