ci: add Forgejo workflows for tests and tagged releases

This commit is contained in:
beefcarver committed 2026-11-14 09:35:17 -05:00
1 parent 456f6afa44
commit 94c9363e1f
2 files changed
+80

No files matched your search

+57
View File
@@ -0,0 +1,57 @@
name: release
on:
push:
tags:
- 'v*'
jobs:
tests:
uses: ./.forgejo/workflows/tests.yml
release:
needs: tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v7
with:
fetch-depth: 0
- name: Check the tag matches the package version
run: |
python3 - <<'PY'
import os, tomllib
from pathlib import Path
pyproject = tomllib.loads(Path("pyproject.toml").read_text())["project"]["version"]
namespace = {}
exec(Path("beefy_player/__init__.py").read_text(), namespace)
tag = os.environ["FORGEJO_REF_NAME"].removeprefix("v")
assert pyproject == namespace["__version__"] == tag, (
pyproject, namespace["__version__"], tag
)
PY
- name: Generate release notes
run: |
previous="$(git describe --tags --abbrev=0 "${FORGEJO_REF_NAME}^" 2>/dev/null || true)"
{
echo "beefy-player ${FORGEJO_REF_NAME#v}"
echo
if [ -n "$previous" ]; then
echo "Changes since $previous:"
git log --pretty='- %s (%h)' "$previous..$FORGEJO_REF_NAME"
else
echo "First tagged release."
fi
} > dist/notes.md
- name: Publish the release
uses: actions/forgejo-release@v2
with:
direction: upload
skip-assets: true
tag: ${{ forgejo.ref_name }}
title: ${{ forgejo.ref_name }}
release-notes-file: dist/notes.md
+23
View File
@@ -0,0 +1,23 @@
name: tests
on:
push:
branches:
- '**'
workflow_call:
jobs:
pytest:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Setup uv
uses: astral-sh/[email protected]
- name: Install dependencies
run: uv sync --frozen
- name: Run the test suite
run: uv run --frozen pytest