Skip to content

0.1.2: fix default base_url + upload() contract #3

0.1.2: fix default base_url + upload() contract

0.1.2: fix default base_url + upload() contract #3

Workflow file for this run

name: publish
# Triggered when you push a tag like v0.1.0 or v0.1.0rc1.
# Uses PyPI Trusted Publishing (OIDC) — no API token to manage.
# Before this works, you must register the GitHub repo as a Trusted
# Publisher in your PyPI project's settings:
# https://docs.pypi.org/trusted-publishers/
#
# Tag format → target:
# v0.1.0rc1 / v0.1.0a1 / v0.1.0b1 → TestPyPI
# v0.1.0 → PyPI
on:
push:
tags:
- "v*"
permissions:
contents: read
jobs:
verify-version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Tag must match _version.py
run: |
set -euo pipefail
TAG="${GITHUB_REF_NAME#v}"
PKG=$(python -c "import re,pathlib;print(re.search(r'__version__\s*=\s*\"([^\"]+)\"', pathlib.Path('hkfilings/_version.py').read_text()).group(1))")
echo "tag=$TAG package=$PKG"
test "$TAG" = "$PKG"
build:
needs: verify-version
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Build sdist + wheel
run: |
python -m pip install --upgrade pip build
python -m build
- name: Smoke-install built wheel
run: |
python -m venv /tmp/v
/tmp/v/bin/pip install dist/*.whl
/tmp/v/bin/python -c "from hkfilings import HKFilingsClient, __version__; print(__version__)"
- uses: actions/upload-artifact@v4
with:
name: dist
path: dist/
publish-testpypi:
needs: build
if: contains(github.ref_name, 'rc') || contains(github.ref_name, 'a') || contains(github.ref_name, 'b')
runs-on: ubuntu-latest
environment:
name: testpypi
url: https://test.pypi.org/project/hkfilings/
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v4
with:
name: dist
path: dist/
- uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
publish-pypi:
needs: build
if: "!contains(github.ref_name, 'rc') && !contains(github.ref_name, 'a') && !contains(github.ref_name, 'b')"
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/project/hkfilings/
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v4
with:
name: dist
path: dist/
- uses: pypa/gh-action-pypi-publish@release/v1