Skip to content

Commit 3516882

Browse files
Updated workflow
1 parent 057f4f2 commit 3516882

File tree

2 files changed

+50
-7
lines changed

2 files changed

+50
-7
lines changed

.github/workflows/release.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@ name: release
33
on:
44
push:
55
branches: [ main ]
6+
# Allow manual dispatch to choose publishing target (pypi or testpypi)
7+
workflow_dispatch:
8+
inputs:
9+
publish_target:
10+
description: 'Where to publish: pypi or testpypi'
11+
required: false
12+
default: 'pypi'
613

714
jobs:
815
test:
@@ -37,7 +44,9 @@ jobs:
3744
run: |
3845
pip-audit -r requirements.txt || true
3946
- name: Semantic Release (version, tag, GitHub release, PyPI)
47+
# Choose which PYPI token to provide based on the optional dispatch input.
48+
# If manually dispatched with publish_target=testpypi, the workflow will use TEST_PYPI_API_TOKEN.
4049
env:
41-
PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
50+
PYPI_TOKEN: ${{ (github.event_name == 'workflow_dispatch' && github.event.inputs.publish_target == 'testpypi') && secrets.TEST_PYPI_API_TOKEN || secrets.PYPI_API_TOKEN }}
4251
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4352
run: semantic-release publish

README.md

Lines changed: 40 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,36 @@ pip install -e .
3434
- Any CLI flag overrides values from `config.yaml`.
3535
- If neither config nor flags provide a value, the tool falls back to environment variables (for emulator detection) or sensible defaults.
3636

37-
Example `config.yaml`:
37+
Example `config.yaml` (full example with comments):
3838

3939
```yaml
40-
project_id: "my-project" # If omitted, ADC/env will be used
41-
emulator_host: "localhost:8010" # If set, uses Datastore Emulator
40+
# Project / environment
41+
project_id: "my-project" # (string) GCP project id. If omitted, ADC or DATASTORE_PROJECT_ID env var will be used.
42+
emulator_host: "localhost:8010" # (string) Datastore emulator host (host:port). If set, the emulator path is used.
43+
44+
# Explicit filters (empty -> iterate all)
45+
namespaces: [""] # (list) Namespaces to include. [""] means include default namespace and allow discovery of others.
46+
kinds: [] # (list) Kinds to include. Empty/omit means discover all kinds per namespace.
47+
48+
# Defaults used by some commands (optional)
49+
kind: "" # (string) Default kind used by analyze-fields when CLI --kind is not provided.
50+
namespace: "" # (string) Default namespace used when CLI --namespace is omitted.
51+
52+
# Cleanup settings
53+
ttl_field: "expireAt" # (string) Property name that contains the TTL/expiry timestamp.
54+
delete_missing_ttl: true # (bool) If true, entities missing the TTL field will be deleted by cleanup.
55+
batch_size: 500 # (int) Number of keys to delete per batch when running cleanup (tunable).
56+
57+
# Analysis settings
58+
group_by_field: null # (string|null) Field name to group analysis by (e.g., batchId). Null means no grouping.
59+
sample_size: 500 # (int) Max entities to sample per-kind/per-group to bound analysis work. Set 0 or null to disable sampling.
60+
enable_parallel: true # (bool) Enable multi-threaded processing for analysis and deletion. Set false to force single-threaded.
61+
62+
# Logging
63+
log_level: "INFO" # (string) Logging level (DEBUG, INFO, WARNING, ERROR).
64+
```
4265
43-
# Explicit filters (empty means all)
44-
namespaces: [""] # Empty -> iterate all namespaces (including default "")
45-
kinds: [] # Empty -> iterate all kinds per namespace
66+
The keys above map directly to CLI flags (CLI flags override values in `config.yaml`). Omit any option to use sensible defaults.
4667

4768
# local-storage-utils — Quickstart
4869

@@ -105,6 +126,19 @@ Development & tests
105126
- Run full test suite locally:
106127
- `make integration`
107128

129+
Publishing
130+
-------
131+
132+
This project uses the `release` workflow to publish releases to PyPI. Follow the packaging tutorial for a complete guide on packaging and publishing: https://packaging.python.org/en/latest/tutorials/packaging-projects/
133+
134+
We support publishing to either TestPyPI (for dry runs) or the real PyPI. The workflow can be triggered automatically on pushes to `main` or manually via the Actions UI (use the "Run workflow" button). When you run it manually you can set the `publish_target` input to `testpypi` to publish to TestPyPI instead of PyPI.
135+
136+
Secrets and tokens
137+
- For production publishing to the real PyPI, set the repository secret named `PYPI_API_TOKEN` with a PyPI API token.
138+
- For test publishing to TestPyPI, set the repository secret named `TEST_PYPI_API_TOKEN` with a TestPyPI API token.
139+
140+
The release workflow selects the appropriate token based on the `publish_target` input. Use TestPyPI first to validate packaging and metadata before publishing to the real index.
141+
108142
Notes
109143
- `sample_size` bounds per-kind/group analysis to avoid scanning entire datasets. Set to 0 or `null` in config to disable sampling.
110144
- `enable_parallel` (default true) enables multi-threaded processing during analysis and deletion; set to false to force single-threaded behavior.

0 commit comments

Comments
 (0)