Skip to content

docs: add just workflow to readme #8

docs: add just workflow to readme

docs: add just workflow to readme #8

Workflow file for this run

# Release + Publish studyctl to PyPI.
# Trigger: push a v* tag.
#
# Combined workflow (release + publish in one) to avoid the GITHUB_TOKEN
# cascade limitation where events created by GITHUB_TOKEN don't trigger
# other workflows.
#
# PyPI setup (one-time):
# 1. Go to https://pypi.org/manage/project/studyctl/settings/publishing/
# 2. Add GitHub as trusted publisher:
# - Owner: NetDevAutomate
# - Repository: socratic-study-mentor
# - Workflow: publish.yml
# - Environment: pypi
name: Release
on:
push:
tags:
- "v*"
permissions:
contents: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Generate changelog for release
uses: orhun/git-cliff-action@v4
id: changelog
with:
config: cliff.toml
args: --latest --strip header
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
body: ${{ steps.changelog.outputs.content }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build:
needs: release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v4
- name: Build package
run: ./scripts/build-release.sh
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: dist
path: dist/
publish:
needs: build
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write # OIDC for PyPI trusted publishing
environment:
name: pypi
url: https://pypi.org/project/studyctl/
steps:
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: dist
path: dist/
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
# No API token needed -- uses OIDC
update-formula:
needs: publish
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
ref: main
- name: Wait for PyPI availability
run: |
VERSION="${GITHUB_REF_NAME#v}"
URL="https://files.pythonhosted.org/packages/source/s/studyctl/studyctl-${VERSION}.tar.gz"
for i in $(seq 1 30); do
if curl -sfI "$URL" >/dev/null 2>&1; then
echo "PyPI tarball available after ${i}0s"
break
fi
echo "Waiting for PyPI... (attempt $i/30)"
sleep 10
done
- name: Update Homebrew formula
run: |
VERSION="${GITHUB_REF_NAME#v}"
URL="https://files.pythonhosted.org/packages/source/s/studyctl/studyctl-${VERSION}.tar.gz"
SHA=$(curl -sL "$URL" | sha256sum | cut -d' ' -f1)
echo "Version: $VERSION"
echo "SHA256: $SHA"
# Update only the main package URL and its sha256 (line immediately after url)
sed -i "s|studyctl-.*\.tar\.gz|studyctl-${VERSION}.tar.gz|" Formula/studyctl.rb
sed -i '/^ url .*studyctl-/{n;s|sha256 ".*"|sha256 "'"${SHA}"'"|;}' Formula/studyctl.rb
grep -A1 'url .*studyctl' Formula/studyctl.rb
- name: Commit and push formula
run: |
VERSION="${GITHUB_REF_NAME#v}"
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add Formula/studyctl.rb
git diff --cached --quiet && echo "No changes" && exit 0
git commit -m "chore: update Homebrew formula to v${VERSION} [skip ci]"
git push