Skip to content

Commit 333e05b

Browse files
chore: better handle packaging
Upload to TestPyPI after some sucessful tests Only keep 2 GA workflows, with all the funny things it means
1 parent ffd3aac commit 333e05b

File tree

3 files changed

+55
-49
lines changed

3 files changed

+55
-49
lines changed

.github/workflows/package-without-publish.yml

-42
This file was deleted.

.github/workflows/release.yml

+41-5
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,51 @@
11
name: Kazoo Awesome Release
22

33
on:
4+
workflow_call:
5+
inputs:
6+
TAG_BUILD:
7+
description: 'The egg info tag build (will be appended to `kazoo.version` value)'
8+
default: ""
9+
required: false
10+
type: string
11+
USE_TEST_PYPI:
12+
description: 'Whether to the use the TestPyPI repository or not'
13+
default: false
14+
required: false
15+
type: boolean
16+
PYTHON_VERSION:
17+
description: 'The Python version to use to perform the steps'
18+
default: ""
19+
required: true
20+
type: string
421
push:
522
tags:
623
- '*'
724

25+
env:
26+
DEFAULT_TOOLING_PYTHON_VERSION: "3.10"
27+
828
jobs:
929
build-and-release:
10-
name: Build and release Kazoo to Pypi
30+
name: Build and release Kazoo to PyPI
1131
runs-on: ubuntu-latest
1232
steps:
33+
34+
# this is to handle the on:push:tags case, to which it is not possible to set
35+
# default values
36+
- name: Maybe set default vars
37+
id: thevars
38+
run: |
39+
DEFINED_PYTHON_VERSION=${{ github.event.inputs.PYTHON_VERSION }}
40+
echo "::set-output name=PYTHON_VERSION::${DEFINED_PYTHON_VERSION:-"${{ env.DEFAULT_TOOLING_PYTHON_VERSION }}"}"
41+
1342
- name: Handle the code
1443
uses: actions/checkout@v3
1544

16-
- name: Set up Python 3.10
45+
- name: Set up Python
1746
uses: actions/setup-python@v4
1847
with:
19-
python-version: "3.10"
48+
python-version: ${{ steps.thevars.outputs.PYTHON_VERSION }}
2049

2150
- name: Install pypa/build
2251
run: >-
@@ -30,14 +59,21 @@ jobs:
3059
python -m
3160
build
3261
-C--global-option=egg_info
33-
-C--global-option=--tag-build=""
62+
-C--global-option=--tag-build="${{ inputs.TAG_BUILD }}"
3463
--sdist
3564
--wheel
3665
--outdir dist/
3766
.
3867
68+
- name: Publish Kazoo to TestPyPI
69+
if: inputs.USE_TEST_PYPI == 'true'
70+
uses: pypa/gh-action-pypi-publish@master
71+
with:
72+
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
73+
repository_url: https://test.pypi.org/legacy/
74+
3975
- name: Publish Kazoo to PyPI
40-
if: startsWith(github.ref, 'refs/tags')
76+
if: inputs.USE_TEST_PYPI == 'false'
4177
uses: pypa/gh-action-pypi-publish@master
4278
with:
4379
password: ${{ secrets.PYPI_API_TOKEN }}

.github/workflows/testing.yml

+14-2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ on:
1010
- master
1111
- release/*
1212

13+
env:
14+
TOOLING_PYTHON_VERSION: "3.10"
15+
TEST_PYPI_URL: https://test.pypi.org/legacy/
16+
1317
jobs:
1418
validate:
1519
name: Code Validation
@@ -20,10 +24,10 @@ jobs:
2024
- name: Handle the code
2125
uses: actions/checkout@v3
2226

23-
- name: "Set up Python 3.10"
27+
- name: "Set up Python"
2428
uses: actions/setup-python@v4
2529
with:
26-
python-version: "3.10"
30+
python-version: ${{ env.TOOLING_PYTHON_VERSION }}
2731

2832
- name: Handle pip cache
2933
uses: actions/cache@v3
@@ -111,3 +115,11 @@ jobs:
111115

112116
- name: Publish Codecov report
113117
uses: codecov/codecov-action@v3
118+
119+
package_and_release:
120+
needs: [test]
121+
uses: ./.github/workflows/release.yml
122+
with:
123+
TAG_BUILD: dev-${{ github.sha }}
124+
USE_TEST_PYPI: true
125+
PYTHON_VERSION: ${{ env.TOOLING_PYTHON_VERSION }}

0 commit comments

Comments
 (0)