Skip to content

Commit 6b48e9a

Browse files
committed
Create PyPI uploading action
1 parent e170f0a commit 6b48e9a

File tree

2 files changed

+53
-1
lines changed

2 files changed

+53
-1
lines changed

.github/workflows/pypi.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Repository Dispatch
2+
on:
3+
repository_dispatch:
4+
types: [pypi-upload]
5+
jobs:
6+
deploy:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v2
10+
with:
11+
ref: ${{ github.event.client_payload.ref }}
12+
- run: echo ${{ github.event.client_payload.sha }}
13+
- name: Set up Python
14+
uses: actions/setup-python@v1
15+
with:
16+
python-version: 3.8
17+
- name: Sleep to wait for CI to comlete
18+
run: |
19+
sleep 600
20+
- name: Installl script dependencies
21+
run: |
22+
python -m pip install scikit-build
23+
- name: Fetch the wheels from the release
24+
run: |
25+
curl -s https://api.github.com/repos/TkinterEP/python-tkextrafont/releases/latest | grep "browser_download_url.*whl" | cut -d : -f 2,3 | tr -d \" | wget -qi - -P dist/
26+
- name: Build a source distribution
27+
run: |
28+
python setup.py sdist
29+
- name: Check Tag
30+
id: check-tag
31+
run: |
32+
if [[ ${{ github.event.client_payload.ref }} =~ ^refs/tags/v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
33+
echo ::set-output name=match::true
34+
fi
35+
- name: Upload to PyPI
36+
if: steps.check-tag.outputs.match == 'true'
37+
uses: pypa/gh-action-pypi-publish@release/v1
38+
with:
39+
user: __token__
40+
password: ${{ secrets.PYPI_API_TOKEN }}
41+
- name: Upload to TEST PyPI
42+
uses: pypa/gh-action-pypi-publish@release/v1
43+
with:
44+
user: __token__
45+
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
46+
repository_url: https://test.pypi.org/legacy/
Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,11 @@ jobs:
3434
file: dist/*-manylinux*.whl
3535
tag: ${{ github.ref }}
3636
overwrite: true
37-
3837
file_glob: true
38+
- name: PyPI Dispatch
39+
uses: peter-evans/repository-dispatch@v1
40+
with:
41+
token: ${{ secrets.DEPLOY_TOKEN }}
42+
repository: TkinterEP/python-tkextrafont
43+
event-type: pypi-upload
44+
client-payload: '{"ref": "${{ github.ref }}", "sha": "${{ github.sha }}"}'

0 commit comments

Comments
 (0)