Files
beefy-player/.forgejo/workflows/release.yml
T

70 lines
2.1 KiB
YAML

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: Setup uv
uses: astral-sh/[email protected]
# No `submodules:` on the checkout above, so the tap is empty here and the
# sdist below differs from a local `uv build` with the submodule populated.
# The published asset is therefore the authority: tools/bump_packaging.py
# hashes the download, never a rebuild.
- name: Build the sdist and wheel
run: |
uv build --out-dir dist/release
# PKGBUILD and the tap formula name this exact file.
test -f "dist/release/beefy_player-${FORGEJO_REF_NAME#v}.tar.gz"
- 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
tag: ${{ forgejo.ref_name }}
title: ${{ forgejo.ref_name }}
release-notes-file: dist/notes.md