-
Notifications
You must be signed in to change notification settings - Fork 6
113 lines (94 loc) · 2.73 KB
/
publish.yml
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
name: 🏗️Build and 📦publish ☀️release
on: push
jobs:
build:
name: 🏗️ build package
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Set up Python 3.8
uses: actions/setup-python@v1
with:
python-version: 3.8
- name: Install pypa/build
run: >-
python -m
pip install
build
--user
- name: Build a binary wheel and a source tarball
run: >-
python -m
build
--sdist
--wheel
--outdir dist/
.
- uses: actions/upload-artifact@master
with:
name: buildfiles
path: .
pubishtest:
if: "!startsWith(github.ref, 'refs/tags/v')"
name: 📦 publish to TestPyPI
runs-on: ubuntu-latest
needs: [ build ]
steps:
- uses: actions/download-artifact@master
with:
name: buildfiles
path: .
- name: Publish distribution 📦 to Test PyPI
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/
publish:
if: "startsWith(github.ref, 'refs/tags/v')"
name: 📦 publish to PyPI
runs-on: ubuntu-latest
needs: [build]
steps:
- uses: actions/download-artifact@master
with:
name: buildfiles
path: .
- name: Get version from tag
id: tag_name
run: |
echo ::set-output name=current_version::${GITHUB_REF#refs/tags/v}
- name: fetch changelog info
id: changelog_reader
uses: mindsers/changelog-reader-action@v2
with:
version: ${{ steps.tag_name.outputs.current_version }}
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.PYPI_API_TOKEN }}
release:
name: ☀️ create release
runs-on: ubuntu-latest
needs: [build]
if: "startsWith(github.ref, 'refs/tags/v')"
steps:
- uses: actions/download-artifact@master
with:
name: buildfiles
path: .
- name: Get version from tag
id: tag_name
run: |
echo ::set-output name=current_version::${GITHUB_REF#refs/tags/v}
- name: fetch changelog info
id: changelog_reader
uses: mindsers/changelog-reader-action@v2
with:
version: ${{ steps.tag_name.outputs.current_version }}
- name: create release
uses: softprops/action-gh-release@v1
with:
files: dist/*
body: ${{ steps.changelog_reader.outputs.changes }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}