Merge branch 'npm-publish' (Fixes #1930)

This commit is contained in:
Reuben Morais 2021-08-02 21:07:28 +02:00
commit b5db9b2f41
1 changed files with 34 additions and 0 deletions

View File

@ -877,6 +877,40 @@ jobs:
EOF
- run: |
twine upload --repository pypi *.whl
npmjs-publish:
name: "Upload STT packages to npmjs.com"
runs-on: ubuntu-20.04
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
needs: [repackage-nodejs-allplatforms]
steps:
- uses: actions/setup-node@v2
with:
node-version: 12
registry-url: 'https://registry.npmjs.org'
- uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Compute tag for npm from git tag
id: compute-npm-tag
run: |
pip install semver
cat <<EOF | python - "${{ github.ref }}"
import sys
import semver
ref = sys.argv[1]
prefix = "refs/tags/v"
assert ref.startswith(prefix)
parsed = semver.parse_version_info(ref[len(prefix):])
print("::set-output name=npm-tag::{}".format("prerelease" if parsed.prerelease else "latest"))
EOF
- uses: actions/download-artifact@v2
with:
name: stt-tflite.tgz
path: ${{ github.workspace }}/
- run: |
npm publish --access=public --verbose ${{ github.workspace }}/stt-*.tgz --tag ${{ steps.compute-npm-tag.outputs.npm-tag }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
# macOS jobs
swig_macOS:
name: "Mac|Build SWIG"