Skip to content

Commit 7eebc6e

Browse files
committed
update and modernize release and publish
1 parent 338027d commit 7eebc6e

File tree

1 file changed

+54
-61
lines changed

1 file changed

+54
-61
lines changed

.github/workflows/release_and_publish.yml

Lines changed: 54 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -7,66 +7,59 @@
77
# under the user's name, not the organzation.
88

99
#--------------------------------------------------
10-
name: release_and_publish
10+
name: Release & Publish
1111

12-
on:
13-
push:
14-
# Sequence of patterns matched against refs/tags
15-
tags:
16-
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
12+
on:
13+
push:
14+
# Sequence of patterns matched against refs/tags
15+
tags:
16+
- "v*" # Push events to matching v*, i.e. v1.0, v20.15.10
1717

18-
jobs:
19-
build:
20-
runs-on: ubuntu-latest
21-
steps:
22-
- uses: actions/checkout@v2
23-
- name: Set up Python
24-
uses: actions/setup-python@v2
25-
with:
26-
python-version: '3.x'
27-
- name: Install dependencies
28-
run: |
29-
python -m pip install --upgrade pip
30-
pip install setuptools wheel twine jupyter urllib3 pandas pyyaml
31-
python setup.py sdist bdist_wheel
32-
- name: Run Changelog
33-
run: |
34-
jupyter nbconvert --to notebook --execute --inplace --ExecutePreprocessor.timeout=-1 --ExecutePreprocessor.kernel_name=python3 tools/gitcount.ipynb
35-
- name: Cat Changelog
36-
uses: pCYSl5EDgo/cat@master
37-
id: changetxt
38-
with:
39-
path: ./tools/changelog.md
40-
env:
41-
TEXT: ${{ steps.changetxt.outputs.text }}
42-
- name: Create Release
43-
id: create_release
44-
uses: actions/create-release@v1
45-
env:
46-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # token is provided by GHA, DO NOT create
47-
with:
48-
tag_name: ${{ github.ref }}
49-
release_name: Release ${{ github.ref }}
50-
body: ${{ steps.changetxt.outputs.text }}
51-
draft: false
52-
prerelease: false
53-
- name: Get Asset name
54-
run: |
55-
export PKG=$(ls dist/)
56-
set -- $PKG
57-
echo "name=$1" >> $GITHUB_ENV
58-
- name: Upload Release Asset
59-
id: upload-release-asset
60-
uses: actions/upload-release-asset@v1
61-
env:
62-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
63-
with:
64-
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
65-
asset_path: dist/${{ env.name }}
66-
asset_name: ${{ env.name }}
67-
asset_content_type: application/zip
68-
- name: Publish distribution 📦 to PyPI
69-
uses: pypa/gh-action-pypi-publish@master
70-
with:
71-
user: __token__
72-
password: ${{ secrets.PYPI_PASSWORD }}
18+
jobs:
19+
build:
20+
name: Create release & publish to PyPI
21+
runs-on: ubuntu-latest
22+
steps:
23+
- name: Checkout repo
24+
uses: actions/checkout@v2
25+
26+
- name: Set up python
27+
uses: actions/setup-python@v2
28+
with:
29+
python-version: "3.x"
30+
31+
- name: Install Dependencies
32+
run: |
33+
python -m pip install --upgrade pip
34+
pip install setuptools wheel twine jupyter urllib3 pandas pyyaml
35+
python setup.py sdist bdist_wheel
36+
37+
- name: run Changelog
38+
run: |
39+
jupyter nbconvert --to notebook --execute --inplace --ExecutePreprocessor.timeout=-1 --ExecutePreprocessor.kernel_name=python3 tools/gitcount.ipynb
40+
41+
- name: cat Changelog
42+
uses: pCYSl5EDgo/cat@master
43+
id: changetxt
44+
with:
45+
path: ./tools/changelog.md
46+
env:
47+
TEXT: ${{ steps.changetxt.outputs.text }}
48+
49+
- name: Get the tag name
50+
run: echo "TAG=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV
51+
52+
- name: Release
53+
uses: softprops/action-gh-release@v1
54+
with:
55+
body: ${{ steps.changetxt.outputs.text }}
56+
body_path: ${{ steps.changetxt.outputs.path }}
57+
name: Release ${{ env.TAG }}
58+
env:
59+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
60+
61+
- name: Publish distribution 📦 to PyPI
62+
uses: pypa/gh-action-pypi-publish@master
63+
with:
64+
user: __token__
65+
password: ${{ secrets.PYPI_PASSWORD }}

0 commit comments

Comments
 (0)