Skip to content

Merge pull request #29 from brainelectronics/feature/add-meta-data-pa… #17

Merge pull request #29 from brainelectronics/feature/add-meta-data-pa…

Merge pull request #29 from brainelectronics/feature/add-meta-data-pa… #17

Workflow file for this run

---
# this file is *not* meant to cover or endorse the use of GitHub Actions, but rather to
# help make automated releases for this project
name: Upload Python Package
on:
push:
branches:
- main
permissions:
contents: write
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
# all history is needed to crawl it properly
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.9'
- name: Install build and deploy dependencies
run: |
python -m pip install -U setuptools wheel build
if [ -f requirements-deploy.txt ]; then pip install -r requirements-deploy.txt; fi
pip install .
- name: Update changelog with snippets
run: |
changelog-generator \
changelog changelog.md \
--snippets=.snippets \
--in-place
- name: Parse changelog
id: parse_changelog
run: |
changelog2version --changelog_file changelog.md --print | python -c "import sys, json; print(json.load(sys.stdin)['info']['description'])" > latest_description.txt
echo 'LATEST_DESCRIPTION<<"EOT"' >> $GITHUB_OUTPUT
cat latest_description.txt >> $GITHUB_OUTPUT
echo '"EOT"' >> $GITHUB_OUTPUT
latest_version=$(changelog2version --changelog_file changelog.md --print | python -c "import sys, json; print(json.load(sys.stdin)['info']['version'])")
echo "latest_version=$latest_version" >> $GITHUB_ENV
- name: Build package
run: |
changelog2version \
--changelog_file changelog.md \
--version_file src/changelog2version/version.py \
--version_file_type py \
--debug
python -m build .
- name: Publish package
uses: pypa/gh-action-pypi-publish@release/v1.5
with:
password: ${{ secrets.PYPI_API_TOKEN }}
skip_existing: true
verbose: true
print_hash: true
- name: Create Release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.latest_version }}
release_name: ${{ env.latest_version }}
body: ${{ steps.parse_changelog.outputs.LATEST_DESCRIPTION }}
draft: false
prerelease: false