Skip to content

Commit

Permalink
feat: test pip package publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
danielgrittner committed Aug 19, 2024
1 parent 327371d commit 61d717f
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 8 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/publish-to-pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Publish PyPI Package
on:
workflow_call:
jobs:
publish_to_pypi:
name: Publish Python package to PyPI
runs-on: ubuntu-latest
# Set permissions for trusted publishing.
permissions:
id-token: write
contents: read
steps:
- uses: actions/[email protected]
# - name: Get the version from the github tag ref
# id: get_version
# run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.12
- name: Install Poetry
uses: snok/[email protected]
with:
virtualenvs-create: true
virtualenvs-in-project: true
# - name: Update version (kept at 0.0.0) in pyproject.toml and build
# run: |
# poetry version ${{ github.ref_name }}
# poetry build
- name: Build package
run: poetry build
- name: Mint token
id: mint
uses: tschm/[email protected]
- name: Publish the package with poetry
run: |
poetry publish -u __token__ -p '${{ steps.mint.outputs.api-token }}'
13 changes: 6 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,12 @@ jobs:
with:
os: ubuntu-latest
secrets: inherit
# TODO: WIP
# publish-python-package:
# if: github.repository == 'Admyral-Security/admyral'
# needs:
# - setup-and-test
# uses: ./.github/workflows/publish-to-pypi.yml
# secrets: inherit
publish-python-package:
if: github.repository == 'Admyral-Security/admyral'
needs:
- setup-and-test
uses: ./.github/workflows/publish-to-pypi.yml
secrets: inherit
publish-docker-images:
if: github.repository == 'Admyral-Security/admyral'
needs:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
with:
python-version: 3.12
- name: Install Poetry
uses: snok/install-poetry@v1.3.4
uses: snok/install-poetry@v1.8.2
with:
virtualenvs-create: true
virtualenvs-in-project: true
Expand Down
2 changes: 2 additions & 0 deletions admyral/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
__version__ = "0.1.0"

from admyral.logger import setup_root_logger

setup_root_logger()

0 comments on commit 61d717f

Please sign in to comment.