Skip to content

Bump coverage from 7.4.4 to 7.5.0 #67

Bump coverage from 7.4.4 to 7.5.0

Bump coverage from 7.4.4 to 7.5.0 #67

Workflow file for this run

name: Test/Build/Publish
on:
push:
pull_request:
workflow_dispatch:
inputs:
version:
# see: https://python-poetry.org/docs/cli/#version
description: 'Version to create'
required: true
default: 'patch'
type: choice
options:
- patch
- minor
- major
- prerelease
- prepatch
- preminor
- premajor
jobs:
verify:
name: Lint and test the code with python
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12" ]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install poetry
poetry install --with test
- name: Lint
run: poetry run lint
- name: Test
run: poetry run test
build:
name: Build distribution 📦
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
needs:
- verify
runs-on: ubuntu-latest
permissions:
contents: write
outputs:
version_tag: ${{ steps.version_tag.outputs.version_tag }}
steps:
- if: github.event_name == 'workflow_dispatch'
run: |
if [[ "${{ github.ref }}" != "refs/heads/master" ]] && [[ "${{ github.event.inputs.version }}" =~ ^(patch|minor|major)$ ]];
then
echo "Final versions can only be built from master branch"
exit 1
fi
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.x"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install poetry
poetry install --with test --with ci
- name: Lint
run: poetry run lint
- name: Test
run: poetry run test
- name: Generate badges
run: poetry run ci-badges
- name: Set new version from manual dispatch input
if: github.event_name == 'workflow_dispatch'
run: poetry version ${{ github.event.inputs.version }}
- name: Set new version from tag
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
run: tag="${{ github.ref_name }}"; poetry version ${tag#"v"}
- name: Set new prerelease version
if: github.event_name == 'push' && !startsWith(github.ref, 'refs/tags/')
run: poetry version prerelease
- name: Build a binary wheel and a source tarball
run: poetry build
- name: Store the distribution packages
uses: actions/upload-artifact@v3
with:
name: python-package-distributions
path: dist/
- name: GIT commit reports and new version
# will not work for tag pushes yet: fatal: You are not currently on a branch.
if: true && !startsWith(github.ref, 'refs/tags/')
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions@noreply.github.com"
git add reports pyproject.toml
git commit -m "CI Results"
git push
- id: version_tag
if: github.event_name == 'workflow_dispatch'
run: echo "version_tag=v$(poetry version -s)" >> "$GITHUB_OUTPUT"
publish-to-pypi:
name: >-
Publish Python 🐍 distribution 📦 to PyPI
# only publish to PyPI on tag pushes or manual dispatches
#if: (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')) || github.event_name == 'workflow_dispatch'
if: github.event_name == 'workflow_dispatch'
needs:
- build
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/certbot-dns-ispconfig-ddns
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing
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
github-release:
name: >-
Sign the Python 🐍 distribution 📦 with Sigstore
and upload them to GitHub Release
needs:
- build
- publish-to-pypi
runs-on: ubuntu-latest
permissions:
contents: write # IMPORTANT: mandatory for making GitHub Releases
id-token: write # IMPORTANT: mandatory for sigstore
steps:
- name: Download all the dists
uses: actions/download-artifact@v3
with:
name: python-package-distributions
path: dist/
- name: Sign the dists with Sigstore
uses: sigstore/gh-action-sigstore-python@v1.2.3
with:
inputs: >-
./dist/*.tar.gz
./dist/*.whl
- name: Upload artifact signatures to GitHub Release
env:
GITHUB_TOKEN: ${{ github.token }}
VERSION_TAG: ${{ needs.build.outputs.version_tag }}
# Upload to GitHub Release using the `gh` CLI.
# `dist/` contains the built packages, and the
# sigstore-produced signatures and certificates.
run: |
gh release create ${VERSION_TAG} --repo '${{ github.repository }}' --generate-notes
gh release upload ${VERSION_TAG} dist/** --repo '${{ github.repository }}'
publish-to-testpypi:
name: Publish Python 🐍 distribution 📦 to TestPyPI
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
needs:
- build
runs-on: ubuntu-latest
environment:
name: testpypi
url: https://test.pypi.org/p/certbot-dns-ispconfig-ddns
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing
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/
skip-existing: false