sms-handler/.forgejo/workflows/build.yaml

71 lines
1.9 KiB
YAML
Raw Normal View History

2024-12-01 00:53:31 +01:00
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
2024-12-01 01:24:26 +01:00
- name: Install the latest version of uv
2024-12-01 01:37:05 +01:00
uses: astral-sh/setup-uv@v4
2024-12-01 02:52:07 +01:00
with:
version: "0.5.5"
2024-12-01 01:24:26 +01:00
2024-12-01 00:53:31 +01:00
- name: Install
2024-12-01 01:24:26 +01:00
run: uv sync
2024-12-01 00:53:31 +01:00
- name: Run tests (API call)
2024-12-01 03:02:11 +01:00
run: .venv/bin/pytest -s tests/basic.py
2024-12-02 18:08:30 +01:00
- name: Build wheel
run: uv build --wheel
2024-12-06 01:47:03 +01:00
- name: Publish Python package (home)
2024-12-02 18:08:30 +01:00
env:
2024-12-02 18:13:04 +01:00
LOCAL_PYPI_TOKEN: ${{ secrets.LOCAL_PYPI_TOKEN }}
2024-12-05 18:37:07 +01:00
run: uv publish --publish-url https://code.philo.ydns.eu/api/packages/philorg/pypi --token $LOCAL_PYPI_TOKEN
2024-12-06 01:47:03 +01:00
- name: Get version
id: version
run: echo "version=$(.venv/bin/sms-handler --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: sms-handler
oci: true
labels: sms-handler
tags: latest ${{ steps.version.outputs.version }}
2024-12-06 01:47:03 +01:00
containerfiles: |
./Containerfile
- name: Push the image to the registry
2024-12-06 01:47:03 +01:00
uses: actions/push-to-registry@v2
with:
registry: "docker://${{ vars.REGISTRY }}/${{ vars.ORGANISATION }}"
2024-12-06 02:06:07 +01:00
image: sms-handler
tags: latest ${{ steps.version.outputs.version }}