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