Skip to content

Commit

Permalink
Merge pull request #14 from AstarVienna/fh/releasestuff
Browse files Browse the repository at this point in the history
Multiple improvements to packaging and release
  • Loading branch information
teutoburg committed Jan 17, 2024
2 parents 0d0605f + 1569716 commit 5674cf3
Show file tree
Hide file tree
Showing 8 changed files with 167 additions and 55 deletions.
94 changes: 94 additions & 0 deletions .github/workflows/bump.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
name: Bump package version
on:
workflow_dispatch:
inputs:
dry-run:
type: boolean
description: Only output new version number, no actual change.
required: false
rule:
type: choice
description: Version bump level
required: true
options:
- major
- minor
- patch
- premajor
- preminor
- prepatch
- prerelease
- "prerelease --next-phase"

workflow_call:
inputs:
dry-run:
type: boolean
description: Only output new version number, no actual change.
required: false
rule:
type: string
description: Version bump level
required: true
branch:
type: string
description: Branch (ref) to checkout and push changes to
required: false
default: ${{ github.ref_name }}
outputs:
bumpmsg:
description: Message created by the version bump.
value: ${{ jobs.bump.outputs.bumpmsg }}

jobs:
bump:
name: Bump version number
runs-on: ubuntu-latest
permissions:
contents: write
outputs:
bumpmsg: ${{ steps.bumping.outputs.BUMP_MSG }}

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ inputs.branch }}

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.11"

- name: Set up Poetry
uses: abatilo/actions-poetry@v2
with:
poetry-version: "1.7.1"

- name: Bump package Version using Poetry
id: bumping
env:
RULE: ${{ inputs.rule }}
DRY: ${{ inputs.dry-run && '--dry-run' || '' }}
run: echo "BUMP_MSG=$(poetry version $DRY $RULE)" >> $GITHUB_OUTPUT

- name: Output debug msg
if: inputs.dry-run
env:
BUMP_MSG: ${{ steps.bumping.outputs.BUMP_MSG }}
run: |
echo "## $BUMP_MSG" >> $GITHUB_STEP_SUMMARY
echo "Dry run only, no actual modification made." >> $GITHUB_STEP_SUMMARY
- name: Commit changes
# could also use https://github.com/stefanzweifel/git-auto-commit-action instead
if: ${{ ! inputs.dry-run }}
env:
BUMP_MSG: ${{ steps.bumping.outputs.BUMP_MSG }}
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git commit -am "$BUMP_MSG"
git push
echo "## $BUMP_MSG" >> $GITHUB_STEP_SUMMARY
echo "Successfully committed and pushed version bump." >> $GITHUB_STEP_SUMMARY
35 changes: 33 additions & 2 deletions .github/workflows/publish_pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,33 @@ jobs:
with:
poetry-version: "1.7.1"

- name: Create step summary
run: echo "## Building $(poetry version)" >> $GITHUB_STEP_SUMMARY

- name: Build package
run: poetry build >> $GITHUB_STEP_SUMMARY

- name: Store distribution files
uses: actions/upload-artifact@v3
with:
name: distribution
path: dist
path: dist/

- name: Upload release attachment
uses: shogo82148/actions-upload-release-asset@v1
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: dist/*

- name: Add to step summary
if: ${{ success() }}
run: echo "### Successfully built package" >> $GITHUB_STEP_SUMMARY

publish:
name: Publish package to PyPI
runs-on: ubuntu-latest
needs: build
if: needs.build.result == 'success'
steps:
- name: Checkout code
uses: actions/checkout@v4
Expand All @@ -46,12 +63,26 @@ jobs:
with:
poetry-version: "1.7.1"

- name: Create step summary
run: echo "## Publishing $(poetry version) to PyPI" >> $GITHUB_STEP_SUMMARY

- name: Retrieve distribution files
uses: actions/download-artifact@v3
with:
name: distribution
path: dist/

- name: Publish to PyPI
env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }}
run: poetry publish
run: poetry publish >> $GITHUB_STEP_SUMMARY

bump:
name: Bump to (next) dev version
needs: publish
if: ${{ needs.publish.result == 'success' }}
uses: ./.github/workflows/bump.yml
secrets: inherit
with:
rule: prerelease
branch: master
25 changes: 13 additions & 12 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,20 @@
version: 2

build:
os: ubuntu-20.04
os: "ubuntu-22.04"
tools:
python: "3.9"
python: "3.11"
jobs:
post_create_environment:
# Install poetry
# https://python-poetry.org/docs/#installing-manually
- pip install poetry
# Tell poetry to not use a virtual environment
- poetry config virtualenvs.create false
post_install:
# Install dependencies with 'docs' dependency group
# https://python-poetry.org/docs/managing-dependencies/#dependency-groups
- poetry install --with docs

sphinx:
configuration: docs/conf.py

python:
install:
- method: pip
path: .
extra_requirements:
- docs

# If using Sphinx, optionally build your docs in additional formats such as PDF
# formats: [] # ignore htmlzip. html is always run
5 changes: 0 additions & 5 deletions AUTHORS.rst

This file was deleted.

27 changes: 27 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Version 0.40.0
**2024-01-XX**

Completely overhauled the package down to the roots.

# Version 0.33.0

## What's Changed
- Remove vegamag as a unit.

# Version 0.23.0

Update versioning scheme.

## What's Changed
- Bug in path resolution in windows solved.

# Version 0.2.0

## What's Changed
- Most functionally is there and tested
- tynt requirement dropped
- Docs updated

# Version 0.1.0

Basic functionality is there.
20 changes: 0 additions & 20 deletions CHANGELOG.rst

This file was deleted.

2 changes: 0 additions & 2 deletions MANIFEST.in

This file was deleted.

14 changes: 0 additions & 14 deletions guides.rst

This file was deleted.

0 comments on commit 5674cf3

Please sign in to comment.