Skip to content

Log changes

Log changes #79

Workflow file for this run

name: Upload Packages
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- 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 "^## .*$" CHANGELOG.md | grep -oE "[0-9]+\.[0-9]+\.[0-9]+" | 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@v4
if: ${{ env.VER != env.NPM }}
with:
node-version: 20
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 --provenance
if: ${{ env.VER != env.NPM }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_API_TOKEN }}