diff --git a/.github/workflows/publish-to-pypi.yml b/.github/workflows/publish-to-pypi.yml index e69de29b..929a3f1a 100644 --- a/.github/workflows/publish-to-pypi.yml +++ b/.github/workflows/publish-to-pypi.yml @@ -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/checkout@v4.1.1 + # - 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/install-poetry@v1.8.2 + 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/token-mint-action@v1.0.2 + - name: Publish the package with poetry + run: | + poetry publish -u __token__ -p '${{ steps.mint.outputs.api-token }}' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b37dc491..e1ccbea4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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: diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index 6e8dbd34..b5ec9273 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -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 diff --git a/admyral/__init__.py b/admyral/__init__.py index 1f5f515d..8ffef4f9 100644 --- a/admyral/__init__.py +++ b/admyral/__init__.py @@ -1,3 +1,5 @@ +__version__ = "0.1.0" + from admyral.logger import setup_root_logger setup_root_logger()