Skip to content

Move hosted gateway to gateway.corpo.llc #29

Move hosted gateway to gateway.corpo.llc

Move hosted gateway to gateway.corpo.llc #29

Workflow file for this run

name: Release
on:
push:
tags: ["v*"]
permissions:
contents: write
id-token: write # Required for PyPI trusted publisher
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install Python dependencies
run: pip install -e "python-dist/" && pip install pytest
- name: Run Python tests
run: python -m pytest python-dist/tests/ -v
release:
needs: test
runs-on: ubuntu-latest
environment: release
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install build tools
run: pip install build
- name: Get version from tag
id: version
run: echo "version=${GITHUB_REF_NAME}" >> "$GITHUB_OUTPUT"
- name: Sync release version
run: |
VERSION="${{ steps.version.outputs.version }}"
VERSION="${VERSION#v}" # strip leading v
python3 scripts/set_release_version.py "${VERSION}"
- name: Build Python package
run: python -m build python-dist/
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: python-dist/dist/
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
generate_release_notes: true
# Requires SITE_DEPLOY_TOKEN secret with repo scope on corpollc/qntm-site
- name: Update version.json on site
continue-on-error: true
env:
GH_TOKEN: ${{ secrets.SITE_DEPLOY_TOKEN }}
run: |
if [ -z "${GH_TOKEN}" ]; then
echo "SITE_DEPLOY_TOKEN not set; skipping site version update."
exit 0
fi
VERSION="${{ steps.version.outputs.version }}"
CONTENT=$(echo -n "{\"version\": \"${VERSION}\"}" | base64 -w0)
SHA=$(gh api repos/corpollc/qntm-site/contents/version.json --jq '.sha' 2>/dev/null || true)
ARGS=(
--method PUT
-f "message=chore: update version to ${VERSION}"
-f "content=${CONTENT}"
)
if [ -n "$SHA" ]; then
ARGS+=(-f "sha=${SHA}")
fi
gh api repos/corpollc/qntm-site/contents/version.json "${ARGS[@]}"