Skip to content

Commit 6c5afa0

Browse files
authored
cicd: Make it possible to publish prior tags (#436)
On all existing workflows `.github` is checked out along with the code. As result there is no way to push older tags, because workflow definition was different. We need a workflow that allows you to target particular code tag, keeping workflows of original ref.
1 parent dd128b5 commit 6c5afa0

File tree

3 files changed

+74
-4
lines changed

3 files changed

+74
-4
lines changed

.github/workflows/build-push.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,10 @@ on:
1717
- LICENSE
1818
- .github/dependabot.yml
1919
- .github/pull_request_template.md
20-
workflow_dispatch:
2120

2221
jobs:
2322
build-and-publish:
2423
if: "(!contains(github.event.pull_request.labels.*.name, 'disable-test-build')) || github.event_name == 'push' && endsWith(github.event.ref, 'scylla')"
2524
uses: ./.github/workflows/lib-build-and-push.yml
2625
with:
2726
upload: ${{ (github.event_name == 'push' || github.event_name == 'workflow_dispatch' ) && endsWith(github.event.ref, 'scylla') }}
28-
python-version: '3.13'

.github/workflows/lib-build-and-push.yml

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,27 @@ on:
1212
python-version:
1313
description: 'Python version to run on'
1414
type: string
15-
required: true
15+
required: false
1616
default: "3.13"
1717

1818
target:
19-
description: "target os to build for: linux,macos,windows"
19+
description: "Target os to build for: linux,macos,windows"
2020
type: string
2121
required: false
2222
default: "linux,macos-x86,macos-arm,windows,linux-aarch64"
2323

24+
target_tag:
25+
description: "Publish particular tag"
26+
type: string
27+
required: false
28+
default: ""
29+
30+
ignore_tests:
31+
description: "Don't run tests"
32+
type: boolean
33+
required: false
34+
default: false
35+
2436
jobs:
2537
prepare-matrix:
2638
name: "Prepare matrix to run for ${{ inputs.python-version }} on `${{ inputs.target }}`"
@@ -73,6 +85,22 @@ jobs:
7385
steps:
7486
- uses: actions/checkout@v4
7587

88+
- name: Checkout tag ${{ inputs.target_tag }}
89+
if: inputs.target_tag != ''
90+
uses: actions/checkout@v4
91+
with:
92+
ref: ${{ inputs.target_tag }}
93+
94+
- name: Disable tests
95+
if: inputs.ignore_tests
96+
shell: bash
97+
run: |
98+
echo "CIBW_TEST_COMMAND=\"\"" >> $GITHUB_ENV;
99+
echo "CIBW_TEST_SKIP=*" >> $GITHUB_ENV;
100+
echo "CIBW_SKIP=\"cp2* cp36* pp36* cp37* pp37* *i686 *musllinux*\"" >> $GITHUB_ENV;
101+
echo "CIBW_BUILD=\"cp3* pp3*\"" >> $GITHUB_ENV;
102+
echo "CIBW_BEFORE_TEST=\"\"" >> $GITHUB_ENV;
103+
76104
- uses: actions/setup-python@v5
77105
name: Install Python
78106
with:
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Build and upload to PyPi manually
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
upload:
7+
description: 'Upload to PyPI'
8+
type: boolean
9+
required: false
10+
default: false
11+
12+
python-version:
13+
description: 'Python version to run on'
14+
type: string
15+
required: false
16+
default: "3.13"
17+
18+
target:
19+
description: "Target os to build for: linux,macos,windows"
20+
type: string
21+
required: false
22+
default: "linux,macos-x86,macos-arm,windows,linux-aarch64"
23+
24+
target_tag:
25+
description: "Publish particular tag"
26+
type: string
27+
required: false
28+
default: ""
29+
30+
ignore_tests:
31+
description: "Don't run tests"
32+
type: boolean
33+
required: false
34+
default: false
35+
36+
jobs:
37+
build-and-publish:
38+
uses: ./.github/workflows/lib-build-and-push.yml
39+
with:
40+
upload: ${{ inputs.upload }}
41+
python-version: ${{ inputs.python-version }}
42+
ignore_tests: ${{ inputs.ignore_tests }}
43+
target_tag: ${{ inputs.target_tag }}
44+
target: ${{ inputs.target }}

0 commit comments

Comments
 (0)