Skip to content

Commit

Permalink
publish to testpy
Browse files Browse the repository at this point in the history
  • Loading branch information
phreed authored and christo-ph committed Mar 22, 2024
1 parent 741725f commit 8dccf81
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/pypi_ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
runs-on: ubuntu-latest
environment:
name: pipy
url: https://testpi.org/p/mkdocs-build-plantuml-plugin
url: https://pypi.org/p/mkdocs-build-plantuml-plugin
permissions:
id-token: write
steps:
Expand Down
65 changes: 65 additions & 0 deletions .github/workflows/testpi_ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Publish python package to PyPi
on:
push:
branches:
- test

permissions:
contents: write

jobs:
build-python-package:
name: Build distribution packages
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: 3.x
- name: Install dependencies and build distribution packages
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
python setup.py sdist bdist_wheel
twine check dist/*
- name: Store the distribution packages
uses: actions/upload-artifact@v3
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') }}
needs:
- build-python-package
runs-on: ubuntu-latest
environment:
name: pipy
url: https://testpi.org/p/mkdocs-build-plantuml-plugin
permissions:
id-token: write
steps:
- name: Download all the dists
uses: actions/download-artifact@v3
with:
name: python-package-distributions
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 }}

0 comments on commit 8dccf81

Please sign in to comment.