Skip to content

v0.15.2

v0.15.2 #5

Workflow file for this run

name: release
on:
release:
types: [published]
permissions:
contents: read
id-token: write
jobs:
build-and-publish:
runs-on: ubuntu-latest
environment: pypi
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Install uv
uses: astral-sh/setup-uv@v7
- name: Ensure Python (uses your .python-version / requires-python)
run: uv python install
- name: Detect changed packages and publish only those
shell: bash
env:
TAG_NAME: ${{ github.event.release.tag_name }}
run: |
set -euo pipefail
PACKAGES=(
pythonbible
pythonbible-akjv
pythonbible-asv
pythonbible-bbe
pythonbible-bwe
pythonbible-dar
pythonbible-diaglot
pythonbible-dr
pythonbible-etheridge
pythonbible-gb
pythonbible-kjv
pythonbible-leeser
pythonbible-lont
pythonbible-mkjv1963
pythonbible-mont
pythonbible-nheb
pythonbible-oeb
pythonbible-roth
pythonbible-rwebster
pythonbible-rylt
pythonbible-tyn
pythonbible-ukjv
pythonbible-wbs
pythonbible-web
pythonbible-wesley
pythonbible-wmth
pythonbible-wyc
pythonbible-ylt
)
git fetch --prune --tags || git fetch --prune
# find previous tag (by creation date) excluding current release tag
PREV_TAG=$(git tag --sort=-creatordate | grep -v -x "${TAG_NAME}" | head -n1 || true)
echo "current tag: ${TAG_NAME:-<none>}"
echo "previous tag: ${PREV_TAG:-<none>}"
for pkg in "${PACKAGES[@]}"; do
changed=false
if [ -z "$PREV_TAG" ]; then
# no previous tag -> consider package changed (first release)
echo "No previous tag; assuming ${pkg} changed"
changed=true
else
if git diff --name-only "${PREV_TAG}" "${TAG_NAME}" -- "${pkg}" | grep -q .; then
echo "${pkg} has changes between ${PREV_TAG}..${TAG_NAME}"
changed=true
else
echo "No changes detected for ${pkg}; skipping"
fi
fi
if [ "$changed" = true ]; then
# read current version
CUR_VER=$(sed -n 's/^[[:space:]]*version[[:space:]]*=[[:space:]]*"\([^"]*\)".*/\1/p' "${pkg}/pyproject.toml" | head -n1 || true)
if [ -z "${CUR_VER}" ]; then
echo "::error::Could not read version from ${pkg}/pyproject.toml"
exit 1
fi
echo "${pkg} current version: ${CUR_VER}"
# read previous version (if previous tag exists)
if [ -n "$PREV_TAG" ]; then
PREV_VER=$(git show "${PREV_TAG}:${pkg}/pyproject.toml" 2>/dev/null | sed -n 's/^[[:space:]]*version[[:space:]]*=[[:space:]]*"\([^"]*\)".*/\1/p' | head -n1 || true)
else
PREV_VER=""
fi
if [ -n "$PREV_VER" ] && [ "$CUR_VER" = "$PREV_VER" ]; then
echo "::error::Version for ${pkg} not bumped (still ${CUR_VER}). Bump version in ${pkg}/pyproject.toml before publishing."
exit 1
fi
echo "Building and publishing ${pkg} (version ${CUR_VER})"
pushd "${pkg}" >/dev/null
uv build --no-sources
uv publish
popd >/dev/null
fi
done