-
-
Notifications
You must be signed in to change notification settings - Fork 7
69 lines (59 loc) · 1.83 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
68
name: Publish Python Package
on:
release:
types:
- published
workflow_dispatch:
inputs:
upload_url:
required: true
description: upload url of the release the assets need to get uploaded to
workflow_call:
inputs:
upload_url:
required: true
type: string
jobs:
build-publish:
runs-on: ubuntu-latest
environment: release
permissions:
id-token: write
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel
pip install twine
- name: Build package
run: |
python setup.py sdist bdist_wheel
twine check dist/*
- uses: actions/upload-artifact@v4
with:
name: build-artifact
retention-days: 30
if-no-files-found: error
path: dist
- name: Publish to PyPI
uses: pypa/[email protected]
- name: Debug upload_url
if: ${{ always() }}
run: |
echo "event_name: ${{ github.event_name }}"
echo "release.upload_url: ${{ github.event.release.upload_url }}"
echo "inputs.upload_url: ${{ inputs.upload_url }}"
echo "ternary output: ${{ github.event_name == 'release' && github.event.release.upload_url || inputs.upload_url }}"
- name: Upload GitHub Release Artifacts
uses: shogo82148/actions-upload-release-asset@v1
with:
upload_url: "${{ github.event_name == 'release' && github.event.release.upload_url || inputs.upload_url }}"
asset_path: 'dist/*'
overwrite: true