Skip to content

Commit 6610fd7

Browse files
authored
chore: allow release workflow to be manually run and skip pypi upload (#3232)
This makes it possible to manually invoke the release workflow and skip the pypi upload. This is useful if the release workflow was cancelled (or failed) after the pypi upload step. Work towards #3188
1 parent e290801 commit 6610fd7

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

.github/workflows/release.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,13 @@ on:
1919
push:
2020
tags:
2121
- "*.*.*"
22+
workflow_dispatch:
23+
inputs:
24+
publish_to_pypi:
25+
description: 'Publish to PyPI'
26+
required: true
27+
type: boolean
28+
default: true
2229

2330
jobs:
2431
build:
@@ -29,6 +36,7 @@ jobs:
2936
- name: Create release archive and notes
3037
run: .github/workflows/create_archive_and_notes.sh
3138
- name: Publish wheel dist
39+
if: github.event_name == 'push' || github.event.inputs.publish_to_pypi
3240
env:
3341
# This special value tells pypi that the user identity is supplied within the token
3442
TWINE_USERNAME: __token__

RELEASING.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,25 @@ final release (`X.Y.Z`).
4545

4646
Release automation will create a GitHub release and BCR pull request.
4747

48+
### Manually triggering the release workflow
49+
50+
The release workflow can be manually triggered using the GitHub CLI (`gh`).
51+
This is useful for re-running a release or for creating a release from a
52+
specific commit.
53+
54+
To trigger the workflow, use the `gh workflow run` command:
55+
56+
```shell
57+
gh workflow run release.yml --ref <TAG>
58+
```
59+
60+
By default, the workflow will publish the wheel to PyPI. To skip this step,
61+
you can set the `publish_to_pypi` input to `false`:
62+
63+
```shell
64+
gh workflow run release.yml --ref <TAG> -f publish_to_pypi=false
65+
```
66+
4867
### Determining Semantic Version
4968

5069
**rules_python** uses [semantic version](https://semver.org), so releases with

0 commit comments

Comments
 (0)