-
Notifications
You must be signed in to change notification settings - Fork 6
89 lines (70 loc) · 2.29 KB
/
pyrelease.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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
name: PyPI release
# Make a PyPI release. This action:
# - builds the release files
# - checks the tag version matches the source version
# - releases on PyPI using the action
# This uses an action I made that tries to automatically verify the
# release version matches the tag version. If you don't use tags,
# then remove that part. The module name can be configured with
# MOD_NAME below.
# The upload uses a "trusted publisher". Configure PyPI so that it
# knows to accept incoming request from GitHub (no extra auth
# configuration here is needed)
# https://docs.pypi.org/trusted-publishers/using-a-publisher/
# If MOD_NAME not defined, infer it from the current directory. If
# inferred from the directory, '-' is replaced with '_'. This is used
# when checking the version name.
#env:
# MOD_NAME: numpy
on:
# For Github release-based publishing
#release:
# types: [published]
# For tag-based (instead of Github-specific release-based):
push:
tags:
- '*'
jobs:
build:
runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
permissions:
contents: read
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
#with:
# python-version: 3.8
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install flit twine wheel
- name: Build
run: |
flit build
# Verify that the git tag has the same version as the python
# project version.
- uses: rkdarst/action-verify-python-version@main
- uses: actions/upload-artifact@v4
with:
name: dist-directory
path: dist/
upload:
runs-on: ubuntu-latest
needs: build
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
permissions:
id-token: write # for trusted publishing
steps:
- uses: actions/download-artifact@v4
with:
name: dist-directory
path: dist/
- name: Publish on PyPI
uses: pypa/gh-action-pypi-publish@release/v1
#with: (this part is old and no longer needed)
#user: __token__
#password: ${{ secrets.pypi_password }}
#repository_url: https://test.pypi.org/legacy/