From 2f811b5b0dcb0d2918910b06c56b181452def13a Mon Sep 17 00:00:00 2001 From: Lukas Melninkas Date: Fri, 19 Apr 2024 15:48:37 +0300 Subject: [PATCH] Add GHA workflows for publishing --- .github/CODEOWNERS | 2 + .github/release-drafter.yml | 4 ++ .github/workflows/publish-to-pypi.yml | 85 +++++++++++++++++++++++++++ .github/workflows/release-drafter.yml | 15 +++++ 4 files changed, 106 insertions(+) create mode 100644 .github/CODEOWNERS create mode 100644 .github/release-drafter.yml create mode 100644 .github/workflows/publish-to-pypi.yml create mode 100644 .github/workflows/release-drafter.yml diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..e14a254 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,2 @@ +# Default owners for the whole repo +* @argyle-systems/scanner-ops \ No newline at end of file diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml new file mode 100644 index 0000000..0a5d792 --- /dev/null +++ b/.github/release-drafter.yml @@ -0,0 +1,4 @@ +template: | + ## What’s Changed + + $CHANGES \ No newline at end of file diff --git a/.github/workflows/publish-to-pypi.yml b/.github/workflows/publish-to-pypi.yml new file mode 100644 index 0000000..b24210e --- /dev/null +++ b/.github/workflows/publish-to-pypi.yml @@ -0,0 +1,85 @@ +name: Publish to PyPi + +on: + push: + branches: + - master + - main + pull_request: + types: + - opened + - synchronize + release: + types: + - published + workflow_dispatch: + +jobs: + build: + name: Build package + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Set up Python 3.9 + uses: actions/setup-python@v4 + with: + python-version: 3.9 + - name: Install build dependencies + run: python -m pip install poetry==1.4.2 poetry-dynamic-versioning==1.2.0 + - name: Install project + run: poetry install + - name: Build Python package + run: poetry build + - name: Store the distribution packages + uses: actions/upload-artifact@v3 + with: + name: python-package-distributions + path: dist/ + + publish-to-pypi: + name: Publish package to PyPI + needs: + - build + runs-on: ubuntu-latest + + environment: + name: pypi + url: https://pypi.org/p/argyle-pyap + + 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 to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + + publish-to-testpypi: + name: Publish package to TestPyPI + needs: + - build + runs-on: ubuntu-latest + + environment: + name: testpypi + url: https://test.pypi.org/p/argyle-pyap + + 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 to TestPyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + repository-url: https://test.pypi.org/legacy/ \ No newline at end of file diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml new file mode 100644 index 0000000..409a210 --- /dev/null +++ b/.github/workflows/release-drafter.yml @@ -0,0 +1,15 @@ +name: Release Drafter + +on: # yamllint disable-line rule:truthy + push: + branches: + - master + +jobs: + update_release_draft: + runs-on: ubuntu-latest + steps: + # Drafts next Release notes as Pull Requests are merged into "master" + - uses: release-drafter/release-drafter@v5 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file