Upgrade version #14
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: Build, Test, Release | |
on: | |
workflow_dispatch: | |
push: | |
branches: [ main ] | |
paths: | |
- 'src/**' | |
- 'tests/**' | |
- '.github/workflows/**' | |
pull_request: | |
branches: [ main ] | |
paths: | |
- 'src/**' | |
- 'tests/**' | |
- '.github/workflows/**' | |
jobs: | |
build: | |
name: Build and test, Python ${{ matrix.python-version }} | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: [ '3.9' ] | |
environment: | |
name: PyPI | |
url: https://pypi.org/p/extraneous-activity-delays | |
permissions: | |
id-token: write | |
contents: write | |
packages: write | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-python@v3 | |
with: | |
python-version: ${{ matrix.python-version }} | |
architecture: x64 | |
- name: Install poetry | |
shell: bash | |
run: pip install poetry | |
- name: Install project | |
run: | | |
poetry install | |
- name: Test | |
run: | | |
poetry run pytest | |
- name: Get version | |
id: get_version | |
run: | | |
echo "version=$(poetry version --short)" >> "$GITHUB_OUTPUT" | |
- name: Build | |
run: | | |
poetry build | |
- name: Exit if not on main | |
if: github.ref != 'refs/heads/main' | |
run: exit 0 | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: extraneous-activity-delays-${{ steps.get_version.outputs.version }}-py${{ matrix.python-version }} | |
path: dist | |
- name: Generate changelog | |
run: | | |
echo "# Changelog" > CHANGELOG.md | |
echo "" >> CHANGELOG.md | |
echo "\`\`\`" >> CHANGELOG.md | |
git log --pretty=format:"%h - %s (%an)" $(git describe --tags --abbrev=0)..HEAD >> CHANGELOG.md | |
echo "" >> CHANGELOG.md | |
echo "\`\`\`" >> CHANGELOG.md | |
- name: Assign repository tag | |
run: | | |
git tag ${{ steps.get_version.outputs.version }} | |
git push --tags | |
- name: Create release | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: | | |
dist/* | |
tag_name: ${{ steps.get_version.outputs.version }} | |
body_path: CHANGELOG.md | |
- name: Publish to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 |