Add CI and add version option
Some checks failed
/ test (push) Failing after 4s

This commit is contained in:
phil 2024-12-12 03:05:33 +01:00
parent fdc8d2534a
commit af3454f315
2 changed files with 80 additions and 0 deletions

View file

@ -0,0 +1,67 @@
on:
push:
workflow_dispatch:
inputs:
verbose:
description: "Verbose"
required: false
default: false
type: boolean
jobs:
test:
runs-on: container
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install the latest version of uv
uses: astral-sh/setup-uv@v4
with:
version: "0.5.5"
- name: Install
run: uv sync
- name: Build wheel
run: uv build --wheel
- name: Publish Python package (home)
env:
LOCAL_PYPI_TOKEN: ${{ secrets.LOCAL_PYPI_TOKEN }}
run: uv publish --publish-url https://code.philo.ydns.eu/api/packages/philorg/pypi --token $LOCAL_PYPI_TOKEN
- name: Get version
id: version
run: echo "version=$(.venv/bin/tinyseady-mailer --version)" >> $GITHUB_OUTPUT
- name: Workaround for bug of podman-login
run: |
mkdir -p $HOME/.docker
echo "{ \"auths\": {} }" > $HOME/.docker/config.json
- name: Log in to the container registry (with another workaround)
uses: actions/podman-login@v1
with:
registry: ${{ vars.REGISTRY }}
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_PASSWORD }}
auth_file_path: /tmp/auth.json
- name: Build the container image
uses: actions/buildah-build@v1
with:
image: tinyseady-mailer
oci: true
labels: tinyseady-mailer
tags: latest ${{ steps.version.outputs.version }}
containerfiles: |
./Containerfile
- name: Push the image to the registry
uses: actions/push-to-registry@v2
with:
registry: "docker://${{ vars.REGISTRY }}/${{ vars.ORGANISATION }}"
image: tinyseady-mailer
tags: latest ${{ steps.version.outputs.version }}

View file

@ -12,6 +12,19 @@ __doc__ = (
def main() -> None:
from argparse import ArgumentParser
parser = ArgumentParser(description=__doc__)
parser.add_argument(
"-v", "--version", action="store_true", help="Print version and exit"
)
args = parser.parse_args()
if args.version:
from importlib.metadata import version
print(version("tinysteady-mailer"))
sys.exit(0)
if CONFIG is None:
print(__doc__)
sys.exit(0)