diff --git a/.github/actions/prepare_poetry_env/action.yml b/.github/actions/prepare_poetry_env/action.yml new file mode 100644 index 0000000..1dccf28 --- /dev/null +++ b/.github/actions/prepare_poetry_env/action.yml @@ -0,0 +1,21 @@ +name: 'Prepare Poetry environment' +description: 'This composite actions checks out out the project, installs Poetry, and install the project in the Poetry environment' +inputs: + python-version: + description: 'The Python version to use' + required: true + default: '3.8' + +runs: + using: "composite" + steps: + - uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - name: Install Poetry + uses: abatilo/actions-poetry@v2.1.4 + with: + poetry-version: 1.4.0 + - name: Poetry install + run: poetry install + shell: bash diff --git a/.github/workflows/pypi_release.yaml b/.github/workflows/pypi_release.yaml new file mode 100644 index 0000000..29f7538 --- /dev/null +++ b/.github/workflows/pypi_release.yaml @@ -0,0 +1,37 @@ +name: Build & Publish + +on: + push: + tags: '**' + + workflow_dispatch: + +jobs: + + cd-job: + name: Continues Delivery + runs-on: ubuntu-latest + steps: + + - name: SCM Checkout + uses: actions/checkout@v3 + + - name: Setup Python & Poetry Environment + uses: ./.github/actions/prepare_poetry_env + + - name: Build Artifacts + run: poetry build + + - name: PyPi Release + env: + POETRY_HTTP_BASIC_PYPI_USERNAME: "__token__" + POETRY_HTTP_BASIC_PYPI_PASSWORD: "${{ secrets.PYPI_TOKEN }}" + run: poetry publish + + - name: GitHub Release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: > + gh release create ${GITHUB_REF_NAME} + --title ${GITHUB_REF_NAME} -F "./doc/changes/changes_${GITHUB_REF_NAME}.md" + dist/* \ No newline at end of file diff --git a/.github/workflows/pytest.yaml b/.github/workflows/pytest.yaml index d18a3bc..7e1028b 100644 --- a/.github/workflows/pytest.yaml +++ b/.github/workflows/pytest.yaml @@ -1,6 +1,6 @@ name: Run pytest -on: [push, pull_request] +on: [push] jobs: pytest: @@ -11,13 +11,14 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - - name: Install Poetry - uses: abatilo/actions-poetry@v2.1.4 - - name: Install dependencies - run: poetry install - - name: Run pytest - run: poetry run python3 -m pytest + + - name: SCM Checkout + uses: actions/checkout@v3 + + - name: Setup Python & Poetry Environment + uses: ./.github/actions/prepare_poetry_env + with: + python-version: ${{ matrix.python-version }} + + - name: Run pytest + run: poetry run python3 -m pytest