This repository has been archived by the owner on Jul 6, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
67 lines (62 loc) · 1.84 KB
/
publish.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
name: publish
on:
push:
branches:
- main
workflow_dispatch:
inputs:
pypi_release_only:
description: 'Whether to only release to PyPI'
required: false
default: "false"
permissions:
id-token: write
contents: write
pull-requests: write
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: google-github-actions/release-please-action@v4
if: |
github.event_name != 'workflow_dispatch' ||
inputs.pypi_release_only != 'true'
id: release
with:
token: ${{ secrets.GITHUB_TOKEN }}
release-type: python
- name: Set up Python for Poetry
if: |
inputs.pypi_release_only == 'true' ||
steps.release.outputs.release_created == 'true'
uses: actions/setup-python@v4
with:
python-version: "3.12"
- name: Install poetry
if: |
inputs.pypi_release_only == 'true' ||
steps.release.outputs.release_created == 'true'
run: |
python -m pip install -U poetry pip
- name: Set up Python
if: |
inputs.pypi_release_only == 'true' ||
steps.release.outputs.release_created == 'true'
uses: actions/setup-python@v4
with:
python-version: "3.12"
cache: "poetry"
- name: Build package
if: |
inputs.pypi_release_only == 'true' ||
steps.release.outputs.release_created == 'true'
run: |
poetry install -n
poetry build
# https://docs.pypi.org/trusted-publishers/using-a-publisher/
- name: Publish package distributions to PyPI
if: |
inputs.pypi_release_only == 'true' ||
steps.release.outputs.release_created == 'true'
uses: pypa/gh-action-pypi-publish@release/v1