Skip to content

Publish to TestPyPI and Update Homebrew Test #7

Publish to TestPyPI and Update Homebrew Test

Publish to TestPyPI and Update Homebrew Test #7

name: Publish to TestPyPI and Update Homebrew Test
on:
workflow_dispatch: # Manual trigger only
jobs:
build-and-publish-test:
runs-on: ubuntu-latest
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
contents: read
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install uv
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Build package
run: |
uv build
- name: Publish to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
user: __token__
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
skip-existing: true
- name: Get version from package
id: get_version
run: |
VERSION=$(grep -oP '__version__ = "\K[^"]+' chuck_data/version.py)
echo "VERSION=$VERSION" >> "$GITHUB_OUTPUT"
notify-homebrew-test:
runs-on: ubuntu-latest
needs: build-and-publish-test # Only run after TestPyPI publish succeeds
steps:
- name: Check out repository to get version
uses: actions/checkout@v4
- name: Get version from file
id: get_version
run: |
VERSION=$(grep -oP '__version__ = "\K[^"]+' chuck_data/version.py)
echo "VERSION=$VERSION" >> "$GITHUB_OUTPUT"
- name: Send dispatch to homebrew-chuck-data
uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.RELEASE_UPDATE_TOKEN }}
repository: amperity/homebrew-chuck-data
event-type: update-chuck-data-test-formula
client-payload: |
{
"version": "${{ steps.get_version.outputs.VERSION }}"
}