Skip to content

Commit 9eb5a47

Browse files
committed
Add action for when a release is published
1 parent 117ae60 commit 9eb5a47

1 file changed

Lines changed: 36 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Automatically publish to PyPI when a GitHub release is published
2+
name: Publish to PyPI
3+
4+
# Run this action when a release is published
5+
on: # yamllint disable-line rule:truthy
6+
release:
7+
types: [published]
8+
9+
# Updates version.txt, builds, and pushes to PyPI
10+
jobs:
11+
release:
12+
name: Builds and publishes to PyPI
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v2
16+
with:
17+
ref: main
18+
- uses: actions/setup-python@v2
19+
- uses: battila7/get-version-action@v2
20+
- name: Update version.txt
21+
run: |
22+
echo ${{ steps.get_version.outputs.version-without-v }} > speechbrain/version.txt
23+
git config user.name github-actions
24+
git config user.email [email protected]
25+
git add speechbrain/version.txt
26+
git commit -m 'Auto-update version.txt'
27+
git push
28+
- name: Install pypa/build
29+
run: python -m pip install build --user
30+
- name: Build binary wheel and source tarball
31+
run: python -m build --sdist --wheel --outdir dist/
32+
- name: Publish to PyPI
33+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
34+
uses: pypa/gh-action-pypi-publish@release/v1
35+
with:
36+
password: ${{ secrets.PYPI_API_KEY }}

0 commit comments

Comments
 (0)