Skip to content

Commit 4d68fc1

Browse files
committed
Change CI release and upload workflow to new github model
1 parent db33582 commit 4d68fc1

2 files changed

Lines changed: 65 additions & 40 deletions

File tree

.github/workflows/python-publish.yml

Lines changed: 0 additions & 40 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# This workflow will create a github release and upload a Python Package to pypi
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries
3+
name: Release
4+
# Release a new version to different targets in suitable ways
5+
6+
on:
7+
workflow_call: # called from ci.yml
8+
inputs:
9+
to_github:
10+
description: "Create a Github Release (repository snapshot)"
11+
type: boolean
12+
default: true
13+
14+
to_test_pypi:
15+
description: "Publish to Test PyPI."
16+
type: boolean
17+
default: false
18+
19+
to_pypi:
20+
description: "Publish to PyPI."
21+
type: boolean
22+
default: false
23+
24+
25+
jobs:
26+
27+
github:
28+
if: inputs.to_github
29+
name: Create a Github Release (repository snapshot)
30+
runs-on: ubuntu-latest
31+
permissions:
32+
contents: write # needed for creating a GH Release
33+
steps:
34+
- uses: actions/checkout@v3
35+
- uses: softprops/action-gh-release@v1
36+
37+
pypi:
38+
if: inputs.to_pypi || inputs.to_test_pypi
39+
name: Publish to PyPI (and/or compatible repositories)
40+
runs-on: ubuntu-latest
41+
permissions:
42+
id-token: write # needed for "trusted publishing" protocol
43+
steps:
44+
- uses: actions/checkout@v3
45+
46+
- name: Install poetry
47+
run: pipx install poetry
48+
49+
- uses: actions/setup-python@v4
50+
with:
51+
python-version: "3.10"
52+
cache: "poetry"
53+
54+
- name: Build the distribution package
55+
run: poetry build
56+
57+
- name: Publish package to TestPyPI
58+
if: inputs.to_test_pypi
59+
uses: pypa/gh-action-pypi-publish@release/v1
60+
with:
61+
repository-url: https://test.pypi.org/legacy/
62+
63+
- name: Publish package to PyPI
64+
if: inputs.to_pypi
65+
uses: pypa/gh-action-pypi-publish@release/v1

0 commit comments

Comments
 (0)