Skip to content

Commit 9004221

Browse files
committed
add automated release workflow
1 parent a02b1b7 commit 9004221

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

.github/workflows/release.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Publish Package
2+
3+
on:
4+
release:
5+
types: [published]
6+
jobs:
7+
deploy:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v2
11+
- name: Install node
12+
uses: actions/setup-node@v1
13+
with:
14+
node-version: '14.x'
15+
registry-url: 'https://registry.npmjs.org'
16+
- name: Install Python
17+
uses: actions/setup-python@v2
18+
with:
19+
python-version: '3.x'
20+
- name: Install dependencies
21+
run: |
22+
python -m pip install --upgrade pip
23+
pip install packaging setuptools twine wheel
24+
- name: Publish the Python package
25+
env:
26+
TWINE_USERNAME: __token__
27+
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
28+
run: |
29+
python setup.py sdist bdist_wheel
30+
twine upload dist/*
31+
- name: Publish the NPM package
32+
run: |
33+
echo $PRE_RELEASE
34+
if [[ $PRE_RELEASE == "true" ]]; then export TAG="next"; else export TAG="latest"; fi
35+
npm publish --tag ${TAG} --access public
36+
env:
37+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
38+
PRE_RELEASE: ${{ github.event.release.prerelease }}

0 commit comments

Comments
 (0)