ci: publish to Forgejo Packages on release; update install docs
Add twine upload step to release workflow so circuitforge-core lands on both public PyPI and the Circuit-Forge Forgejo Packages index (--extra-index-url for cf-orch installs). Reuses FORGEJO_PYPI_TOKEN for the release creation step. Update installation.md to document editable install pattern and optional extras.
This commit is contained in:
parent
cdeb410f45
commit
a92a83db4b
2 changed files with 46 additions and 12 deletions
|
|
@ -1,4 +1,11 @@
|
|||
name: Release — PyPI
|
||||
name: Release — PyPI + Forgejo Packages
|
||||
|
||||
# circuitforge-core is MIT — published to both public PyPI and the Circuit-Forge
|
||||
# Forgejo Packages index so cf-orch can resolve it from a single --extra-index-url.
|
||||
#
|
||||
# Required secrets:
|
||||
# PYPI_API_TOKEN — public PyPI upload token
|
||||
# FORGEJO_PYPI_TOKEN — Forgejo token with package:write scope
|
||||
|
||||
on:
|
||||
push:
|
||||
|
|
@ -19,29 +26,36 @@ jobs:
|
|||
|
||||
- name: Build
|
||||
run: |
|
||||
pip install build
|
||||
pip install build twine
|
||||
python -m build
|
||||
|
||||
- name: Publish to PyPI
|
||||
- name: Publish to public PyPI
|
||||
uses: pypa/gh-action-pypi-publish@release/v1
|
||||
with:
|
||||
password: ${{ secrets.PYPI_API_TOKEN }}
|
||||
|
||||
- name: Publish to Forgejo Packages
|
||||
env:
|
||||
TWINE_USERNAME: pypi-token
|
||||
TWINE_PASSWORD: ${{ secrets.FORGEJO_PYPI_TOKEN }}
|
||||
TWINE_REPOSITORY_URL: https://git.opensourcesolarpunk.com/api/packages/Circuit-Forge/pypi
|
||||
run: twine upload dist/*
|
||||
|
||||
- name: Create Forgejo release
|
||||
env:
|
||||
FORGEJO_TOKEN: ${{ secrets.FORGEJO_RELEASE_TOKEN }}
|
||||
FORGEJO_TOKEN: ${{ secrets.FORGEJO_PYPI_TOKEN }}
|
||||
run: |
|
||||
TAG="${GITHUB_REF_NAME}"
|
||||
# Check if release already exists for this tag
|
||||
EXISTING=$(curl -sf \
|
||||
-H "Authorization: token ${FORGEJO_TOKEN}" \
|
||||
"https://git.opensourcesolarpunk.com/api/v1/repos/Circuit-Forge/circuitforge-core/releases/tags/${TAG}" \
|
||||
2>/dev/null | jq -r '.id // empty')
|
||||
|
||||
2>/dev/null \
|
||||
| python3 -c "import sys,json; print(json.load(sys.stdin).get('id',''))" 2>/dev/null || true)
|
||||
if [ -z "${EXISTING}" ]; then
|
||||
jq -n --arg tag "${TAG}" \
|
||||
'{"tag_name":$tag,"name":$tag,"draft":false,"prerelease":false}' \
|
||||
| curl -sf -X POST \
|
||||
python3 -c "
|
||||
import json
|
||||
print(json.dumps({'tag_name':'${TAG}','name':'${TAG}','draft':False,'prerelease':False}))
|
||||
" | curl -sf -X POST \
|
||||
-H "Authorization: token ${FORGEJO_TOKEN}" \
|
||||
-H "Content-Type: application/json" \
|
||||
"https://git.opensourcesolarpunk.com/api/v1/repos/Circuit-Forge/circuitforge-core/releases" \
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ circuitforge-core is distributed as an editable install from a local clone. It i
|
|||
## Prerequisites
|
||||
|
||||
- Python 3.11+
|
||||
- A conda environment (CircuitForge uses `cf` by convention; older envs may be named `job-seeker`)
|
||||
- A Python environment — conda or venv (see options below)
|
||||
- The `circuitforge-core` repo cloned alongside your product repo
|
||||
|
||||
## Typical layout
|
||||
|
|
@ -21,6 +21,10 @@ circuitforge-core is distributed as an editable install from a local clone. It i
|
|||
|
||||
## Install
|
||||
|
||||
### Option A: conda (dev machines)
|
||||
|
||||
The CircuitForge conda environment is named `cf`:
|
||||
|
||||
```bash
|
||||
# From inside a product repo, assuming circuitforge-core is a sibling
|
||||
conda run -n cf pip install -e ../circuitforge-core
|
||||
|
|
@ -30,13 +34,29 @@ conda activate cf
|
|||
pip install -e ../circuitforge-core
|
||||
```
|
||||
|
||||
### Option B: venv (server and beta-host deployments)
|
||||
|
||||
For hosts that don't use conda (CI runners, beta VMs, Xander's orchard nodes):
|
||||
|
||||
```bash
|
||||
python3 -m venv .venv
|
||||
source .venv/bin/activate
|
||||
pip install -e /path/to/circuitforge-core
|
||||
```
|
||||
|
||||
Or if cf-core is a sibling directory of the product:
|
||||
|
||||
```bash
|
||||
pip install -e ../circuitforge-core
|
||||
```
|
||||
|
||||
The editable install means changes to circuitforge-core source are reflected immediately in all products without reinstalling. Only restart the product's process after changes (or Docker container if running in Docker).
|
||||
|
||||
## Verify
|
||||
|
||||
```python
|
||||
import circuitforge_core
|
||||
print(circuitforge_core.__version__) # 0.9.0
|
||||
print(circuitforge_core.__version__) # e.g. 0.21.0
|
||||
```
|
||||
|
||||
## Inside Docker
|
||||
|
|
|
|||
Loading…
Reference in a new issue