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:
|
on:
|
||||||
push:
|
push:
|
||||||
|
|
@ -19,29 +26,36 @@ jobs:
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: |
|
run: |
|
||||||
pip install build
|
pip install build twine
|
||||||
python -m build
|
python -m build
|
||||||
|
|
||||||
- name: Publish to PyPI
|
- name: Publish to public PyPI
|
||||||
uses: pypa/gh-action-pypi-publish@release/v1
|
uses: pypa/gh-action-pypi-publish@release/v1
|
||||||
with:
|
with:
|
||||||
password: ${{ secrets.PYPI_API_TOKEN }}
|
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
|
- name: Create Forgejo release
|
||||||
env:
|
env:
|
||||||
FORGEJO_TOKEN: ${{ secrets.FORGEJO_RELEASE_TOKEN }}
|
FORGEJO_TOKEN: ${{ secrets.FORGEJO_PYPI_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
TAG="${GITHUB_REF_NAME}"
|
TAG="${GITHUB_REF_NAME}"
|
||||||
# Check if release already exists for this tag
|
|
||||||
EXISTING=$(curl -sf \
|
EXISTING=$(curl -sf \
|
||||||
-H "Authorization: token ${FORGEJO_TOKEN}" \
|
-H "Authorization: token ${FORGEJO_TOKEN}" \
|
||||||
"https://git.opensourcesolarpunk.com/api/v1/repos/Circuit-Forge/circuitforge-core/releases/tags/${TAG}" \
|
"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
|
if [ -z "${EXISTING}" ]; then
|
||||||
jq -n --arg tag "${TAG}" \
|
python3 -c "
|
||||||
'{"tag_name":$tag,"name":$tag,"draft":false,"prerelease":false}' \
|
import json
|
||||||
| curl -sf -X POST \
|
print(json.dumps({'tag_name':'${TAG}','name':'${TAG}','draft':False,'prerelease':False}))
|
||||||
|
" | curl -sf -X POST \
|
||||||
-H "Authorization: token ${FORGEJO_TOKEN}" \
|
-H "Authorization: token ${FORGEJO_TOKEN}" \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
"https://git.opensourcesolarpunk.com/api/v1/repos/Circuit-Forge/circuitforge-core/releases" \
|
"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
|
## Prerequisites
|
||||||
|
|
||||||
- Python 3.11+
|
- 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
|
- The `circuitforge-core` repo cloned alongside your product repo
|
||||||
|
|
||||||
## Typical layout
|
## Typical layout
|
||||||
|
|
@ -21,6 +21,10 @@ circuitforge-core is distributed as an editable install from a local clone. It i
|
||||||
|
|
||||||
## Install
|
## Install
|
||||||
|
|
||||||
|
### Option A: conda (dev machines)
|
||||||
|
|
||||||
|
The CircuitForge conda environment is named `cf`:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# From inside a product repo, assuming circuitforge-core is a sibling
|
# From inside a product repo, assuming circuitforge-core is a sibling
|
||||||
conda run -n cf pip install -e ../circuitforge-core
|
conda run -n cf pip install -e ../circuitforge-core
|
||||||
|
|
@ -30,13 +34,29 @@ conda activate cf
|
||||||
pip install -e ../circuitforge-core
|
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).
|
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
|
## Verify
|
||||||
|
|
||||||
```python
|
```python
|
||||||
import circuitforge_core
|
import circuitforge_core
|
||||||
print(circuitforge_core.__version__) # 0.9.0
|
print(circuitforge_core.__version__) # e.g. 0.21.0
|
||||||
```
|
```
|
||||||
|
|
||||||
## Inside Docker
|
## Inside Docker
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue