Skip to content

Commit 4512f65

Browse files
committed
Updates to github CI workflows. Use python-ci v1.
1 parent bdc5571 commit 4512f65

File tree

3 files changed

+34
-21
lines changed

3 files changed

+34
-21
lines changed

.github/workflows/ci-release.yaml

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
11
name: Publish and Release
22

3+
# A github reusable workflow to:
4+
# - Run code checks and tests on multiple python versions and platforms;
5+
# - Publish a python package to test.pypi.org and pypi.org; and
6+
# - Create a GitHub Release.
7+
#
8+
# The workflow is triggered on:
9+
# - push to version tags matching "v*", eg. "v1.0.0", or
10+
# - manual workflow_dispatch (eg. from the github `Actions` tab):
11+
# - will produce a release with a version tag like: "v1.0.1.devN"
12+
#
13+
# Uses reusable workflows from the <https://github.com/glenn20/python-ci>
14+
# repository.
15+
316
on:
417
push:
518
tags: ["v*"] # Publish on tags matching "v*", eg. "v1.0.0"
@@ -8,38 +21,33 @@ on:
821
jobs:
922
tests:
1023
name: Tests
11-
uses: glenn20/python-ci/.github/workflows/test.yaml@main
24+
uses: glenn20/python-ci/.github/workflows/check-test-build.yaml@main
1225
with:
1326
os: '["ubuntu-latest", "windows-latest", "macos-latest"]'
1427
python-version: '["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]'
1528

16-
build:
17-
name: Build
18-
needs: tests
19-
uses: glenn20/python-ci/.github/workflows/build.yaml@main
20-
2129
publish-test:
2230
name: Publish to test.pypi
23-
needs: build
2431
uses: ./.github/workflows/publish.yaml
32+
needs: tests
2533
with:
2634
pypi: test.pypi
2735
permissions:
2836
id-token: write # IMPORTANT: mandatory for trusted publishing!
2937

3038
publish-pypi:
3139
name: Publish to pypi
32-
needs: publish-test
3340
uses: ./.github/workflows/publish.yaml
41+
needs: tests
3442
with:
3543
pypi: upload.pypi
3644
permissions:
3745
id-token: write # IMPORTANT: mandatory for trusted publishing!
3846

3947
github-release:
4048
name: Create GitHub release
41-
uses: glenn20/python-ci/.github/workflows/release.yaml@main
42-
needs: publish-pypi
49+
uses: glenn20/python-ci/.github/workflows/release.yaml@v1
50+
needs: tests
4351
permissions:
4452
contents: write # IMPORTANT: mandatory for github release
4553
id-token: write # IMPORTANT: mandatory for github release

.github/workflows/ci-tests.yaml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,17 @@ on:
1515
jobs:
1616
tests:
1717
name: CI tests
18-
uses: glenn20/python-ci/.github/workflows/test.yaml@main
18+
uses: glenn20/python-ci/.github/workflows/check-test-build.yaml@v1
1919
with: # A short test matrix for fast testing of commits
2020
os: '["ubuntu-latest"]'
2121
python-version: '["3.9", "3.13"]'
2222

23-
build:
24-
name: Build
25-
uses: glenn20/python-ci/.github/workflows/build.yaml@main
26-
2723
publish-test:
2824
name: Publish to test.pypi
29-
needs: build
30-
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
25+
needs: tests
26+
if: |
27+
github.event_name == 'workflow_dispatch' ||
28+
(github.event_name == 'push' && github.ref == 'refs/heads/main')
3129
uses: ./.github/workflows/publish.yaml
3230
with:
3331
pypi: test.pypi

.github/workflows/publish.yaml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,29 +20,36 @@ name: Publish python package
2020
# project pages (add the name of the relevant Environment for additional
2121
# access control).
2222
# 4. Call this workflow from a parent workflow with the `pypi` input set to
23-
# "upload.pypi" or "test.pypi" (default).
23+
# "pypi" or "test.pypi" (default).
2424
#
2525
# Invoke with `uses: ./.github/workflows/publish@v1`
2626

2727
on:
2828
workflow_call:
2929
inputs:
3030
pypi:
31-
description: 'Set to "pypi" or "test.pypi" (default).'
31+
description: 'Publish to `upload.pypi` or `test.pypi`:'
3232
default: 'test.pypi'
3333
required: false
3434
type: string
35+
workflow_dispatch:
36+
inputs:
37+
pypi:
38+
description: 'Set to "upload.pypi" or "test.pypi" (default).'
39+
options: ['test.pypi', 'upload.pypi']
40+
type: choice
3541

3642
jobs:
3743
publish:
3844
name: Publish to ${{ inputs.pypi }}
3945
runs-on: ubuntu-latest
4046
environment:
4147
name: publish-${{ inputs.pypi }}
42-
# url: https://${{ inputs.pypi }}.org/p/${{ needs.build.outputs.package-name }}
48+
url: https://${{ inputs.pypi }}.org/p/${{ steps.publish.outputs.package-name }}
4349
permissions:
4450
id-token: write # IMPORTANT: mandatory for trusted publishing
4551
steps:
46-
- uses: glenn20/python-ci/publish@main
52+
- uses: glenn20/python-ci/publish@v1
53+
id: publish
4754
with:
4855
pypi: ${{ inputs.pypi }}

0 commit comments

Comments
 (0)