Skip to content

Commit 2e4ff76

Browse files
jeduardoshano
andcommitted
chore: allow workflow to publish to test locations
Co-authored-by: Shane Dowling <shane@shanedowling.com>
1 parent 28573e2 commit 2e4ff76

File tree

2 files changed

+27
-15
lines changed

2 files changed

+27
-15
lines changed

.github/workflows/publish.yaml

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@ name: "Publish package and documentation"
33
on:
44
release:
55
types: ["published"]
6+
workflow_dispatch:
7+
inputs:
8+
is_test:
9+
description: 'Indicates that the run should publish to the test repositories'
10+
required: false
11+
type: boolean
12+
default: false
613

714
jobs:
815
packages:
@@ -22,16 +29,16 @@ jobs:
2229
with:
2330
enable-cache: true
2431

25-
- name: Build
26-
run: uv build
32+
- name: Build package
33+
run: make build
2734

28-
- name: Publish RC packages to PyPI Test
29-
if: contains(github.event.release.tag_name, '-rc')
35+
- name: Publish packages to PyPI Test
36+
if: ${{ github.event.inputs.run_deploy == 'true' }}
3037
run: |
3138
uv publish --index testpypi --token ${{ secrets.TEST_PYPI_TOKEN }}
3239
3340
- name: Publish release packages to PyPI
34-
if: ${{ ! contains(github.event.release.tag_name, '-rc') }}
41+
if: ${{ github.event.inputs.run_deploy == 'false' }}
3542
run: uv publish --token ${{ secrets.PYPI_TOKEN }}
3643

3744
docs:
@@ -50,19 +57,19 @@ jobs:
5057
enable-cache: true
5158

5259
- name: Generate docs
53-
run: make install generate-docs
60+
run: make generate-docs
5461

55-
- name: Publish RC docs
56-
if: contains(github.event.release.tag_name, '-rc')
62+
- name: Publish release docs to test location
63+
if: ${{ github.event.inputs.run_deploy == 'true' }}
5764
uses: peaceiris/actions-gh-pages@v4
5865
with:
5966
github_token: ${{ secrets.GITHUB_TOKEN }}
6067
publish_dir: ./docs
6168
# this puts the docs for this tag under gh-pages:/rc/<tag>/
6269
destination_dir: rc/${{ github.event.release.tag_name }}
6370

64-
- name: Publish release docs
65-
if: ${{ ! contains(github.event.release.tag_name, '-rc') }}
71+
- name: Publish release docs to production location
72+
if: ${{ github.event.inputs.run_deploy == 'false' }}
6673
uses: peaceiris/actions-gh-pages@v4
6774
with:
6875
github_token: ${{ secrets.GITHUB_TOKEN }}

Makefile

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,30 @@
11
UV_PYTHON ?= 3.12
22

3-
.PHONY: help install test lint fmt generate-docs build-and-load-configure image build-and-load-system-test-image
3+
.PHONY: build help install test lint fmt generate-docs build-and-load-configure image build-and-load-system-test-image
44

55
help: # Show help for each of the Makefile recipes.
66
@grep -E '^[a-zA-Z0-9 -]+:.*#' Makefile | sort | while read -r l; do printf "\033[1;34m$$(echo $$l | cut -f 1 -d':')\033[00m:$$(echo $$l | cut -f 2- -d'#')\n"; done
77

88
install: # install dependencies for running tests and linting
99
uv python install
10+
11+
dev: install # Install development/release dependencies
1012
uv sync --extra dev
1113

12-
test: install # run tests
14+
build: install # build package
15+
uv build
16+
17+
test: install dev # run tests
1318
uv run --isolated --with-editable '.[dev]' pytest
1419

15-
lint: install # run linting checks
20+
lint: install dev # run linting checks
1621
uv run ruff check kratix_sdk tests
1722
uv run ruff format --check kratix_sdk tests
1823

19-
fmt: install # run code formatter
24+
fmt: install dev # run code formatter
2025
uv run ruff format kratix_sdk tests
2126

22-
generate-docs: install # create API documentation
27+
generate-docs: install dev # create API documentation
2328
uv run pdoc src/kratix_sdk -o docs
2429

2530
build-and-load-configure-image: # build example docker image and load it into kind

0 commit comments

Comments
 (0)