File tree 3 files changed +43
-5
lines changed 3 files changed +43
-5
lines changed Original file line number Diff line number Diff line change 10
10
push :
11
11
branches :
12
12
- master
13
+ tags :
14
+ - " *"
15
+
13
16
pull_request :
14
17
branches :
15
18
- master
@@ -154,3 +157,36 @@ jobs:
154
157
flags : ${{ runner.os }}
155
158
fail_ci_if_error : false
156
159
name : ${{ matrix.name }}
160
+
161
+ deploy :
162
+
163
+ runs-on : ubuntu-latest
164
+
165
+ needs : [build]
166
+
167
+ steps :
168
+ - uses : actions/checkout@v1
169
+ - name : Set up Python
170
+ uses : actions/setup-python@v1
171
+ with :
172
+ python-version : " 3.7"
173
+ - name : Install dependencies
174
+ run : |
175
+ python -m pip install --upgrade pip
176
+ pip install --upgrade wheel setuptools tox
177
+ - name : Build package
178
+ run : |
179
+ python setup.py sdist bdist_wheel
180
+ - name : Publish package to PyPI
181
+ if : github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
182
+ uses : pypa/gh-action-pypi-publish@master
183
+ with :
184
+ user : __token__
185
+ password : ${{ secrets.pypi_token }}
186
+ - name : Publish GitHub release notes
187
+ if : github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
188
+ env :
189
+ GH_RELEASE_NOTES_TOKEN : ${{ secrets.release_notes }}
190
+ run : |
191
+ sudo apt-get install pandoc
192
+ tox -e publish-gh-release-notes
Original file line number Diff line number Diff line change @@ -68,19 +68,21 @@ def main(argv):
68
68
if len (argv ) > 1 :
69
69
tag_name = argv [1 ]
70
70
else :
71
- tag_name = os .environ .get ("TRAVIS_TAG " )
71
+ tag_name = os .environ .get ("GITHUB_REF " )
72
72
if not tag_name :
73
- print ("tag_name not given and $TRAVIS_TAG not set" , file = sys .stderr )
73
+ print ("tag_name not given and $GITHUB_REF not set" , file = sys .stderr )
74
74
return 1
75
+ if tag_name .startswith ("refs/tags/" ):
76
+ tag_name = tag_name [len ("refs/tags/" ) :]
75
77
76
78
token = os .environ .get ("GH_RELEASE_NOTES_TOKEN" )
77
79
if not token :
78
80
print ("GH_RELEASE_NOTES_TOKEN not set" , file = sys .stderr )
79
81
return 1
80
82
81
- slug = os .environ .get ("TRAVIS_REPO_SLUG " )
83
+ slug = os .environ .get ("GITHUB_REPOSITORY " )
82
84
if not slug :
83
- print ("TRAVIS_REPO_SLUG not set" , file = sys .stderr )
85
+ print ("GITHUB_REPOSITORY not set" , file = sys .stderr )
84
86
return 1
85
87
86
88
rst_body = parse_changelog (tag_name )
Original file line number Diff line number Diff line change @@ -135,7 +135,7 @@ commands = python scripts/release.py {posargs}
135
135
description = create GitHub release after deployment
136
136
basepython = python3
137
137
usedevelop = True
138
- passenv = GH_RELEASE_NOTES_TOKEN TRAVIS_TAG TRAVIS_REPO_SLUG
138
+ passenv = GH_RELEASE_NOTES_TOKEN GITHUB_REF GITHUB_REPOSITORY
139
139
deps =
140
140
github3.py
141
141
pypandoc
You can’t perform that action at this time.
0 commit comments