Skip to content

Commit

Permalink
Automate git tagging with GitHub Action
Browse files Browse the repository at this point in the history
-[ADDED] GitHub Action adds git tag after releasing package to PyPi
-[CHANGED] Version number now in separate file
  • Loading branch information
aarons20 authored and christo-ph committed Nov 19, 2023
1 parent 335a200 commit 6b4a6e6
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 6 deletions.
24 changes: 19 additions & 5 deletions .github/workflows/pypi_ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ permissions:
jobs:
build-python-package:
name: Build distribution packages
runs-on: ubuntu-latest

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
Expand All @@ -29,7 +28,7 @@ jobs:
with:
name: python-package-distributions
path: dist/

publish-to-pypi:
name: Publish Python distribution package to PyPI
if: ${{ github.repository == 'quantorconsulting/mkdocs_build_plantuml' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master') }}
Expand All @@ -40,8 +39,7 @@ jobs:
name: pipy
url: https://pypi.org/p/mkdocs-build-plantuml-plugin
permissions:
id-token: write

id-token: write
steps:
- name: Download all the dists
uses: actions/download-artifact@v3
Expand All @@ -50,3 +48,19 @@ jobs:
path: dist/
- name: Publish distribution packages to PyPI
uses: pypa/gh-action-pypi-publish@release/v1

add-git-tag:
name: Add version tag to repository
needs:
- publish-to-pypi
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Get version from VERSION file
id: get_version
run: |
echo "version=$(cat VERSION)" >> $GITHUB_OUTPUT
- name: Create and push tag
run: |
git tag ${{ steps.get_version.outputs.version }}
git push origin ${{ steps.get_version.outputs.version }}
1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.9.0
5 changes: 4 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@
long_description = f.read()


with open('VERSION', 'r') as f:
__version__ = f.read().strip()

setup(
name="mkdocs-build-plantuml-plugin",
version="1.9.0",
version=__version__,
description="An MkDocs plugin to call plantuml locally or remote",
long_description=long_description,
long_description_content_type="text/markdown",
Expand Down

0 comments on commit 6b4a6e6

Please sign in to comment.