Skip to content

Commit 2918ef9

Browse files
committed
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 (cherry picked from commit 6610fd7)
1 parent 24146a4 commit 2918ef9

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
@@ -48,6 +48,25 @@ final release (`X.Y.Z`).
4848

4949
Release automation will create a GitHub release and BCR pull request.
5050

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

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

0 commit comments

Comments
 (0)