Stricter regex for capturing local version #66
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Upload Python Package | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v3 | |
with: | |
python-version: '3.x' | |
- name: Install dependencies | |
run: pip install build twine jsonschema requests | |
- name: Get versions | |
run: | | |
echo "NPM=$(npm v dctrackclient version)" >> "${GITHUB_ENV}" | |
echo "PYPI=$(python .github/workflows/pypi-ver.py dctrackclient)" >> "${GITHUB_ENV}" | |
echo "VER=$(grep -oE "(?<=^## +)[0-9]+\.[0-9]+\.[0-9]+$" CHANGELOG.md | head -n1)" >> "${GITHUB_ENV}" | |
- name: Update versions | |
run: sed -i 's/%VERSION%/${{ env.VER }}/g' py/pyproject.toml py/src/dcTrackClient/__init__.py js/package.json js/src/index.js README.md | |
- name: Generate code | |
run: python .github/workflows/gen.py | |
- name: Build Python package | |
run: python -m build py | |
if: ${{ env.VER != env.PYPI }} | |
- name: Publish Python package | |
run: python -m twine upload py/dist/* -u __token__ -p ${{ secrets.PYPI_API_TOKEN }} | |
if: ${{ env.VER != env.PYPI }} | |
- name: Set up Node | |
uses: actions/setup-node@v3 | |
if: ${{ env.VER != env.NPM }} | |
with: | |
node-version: 18 | |
registry-url: 'https://registry.npmjs.org' | |
- name: Copy readme | |
run: cp README.md js | |
if: ${{ env.VER != env.NPM }} | |
- name: Publish Node package | |
run: cd js && npm publish | |
if: ${{ env.VER != env.NPM }} | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_API_TOKEN }} |