Skip to content

Merge pull request #53 from ParclLabs/unit-sdk #43

Merge pull request #53 from ParclLabs/unit-sdk

Merge pull request #53 from ParclLabs/unit-sdk #43

name: Publish Package
on:
push:
branches:
- main
jobs:
build-and-release:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.9
cache: 'pipenv'
- name: Install Pip amd Dependencies
run: |
python -m pip install --upgrade pip
python -m pip install pipenv twine build hatch
pipenv install --dev --python python
- name: Run Lint
run: |
set -e
pipenv run make lint
- name: Run tests
run: |
set -e
pipenv run make test
- name: Extract version
run: |
set -e
echo "VERSION=$(pipenv run python tools/print_version.py)" >> $GITHUB_ENV
- name: Tag Repository
uses: actions/github-script@v7
with:
script: |
const tagName = '${{ env.VERSION }}';
const ref = 'refs/tags/' + tagName;
github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: ref,
sha: context.sha
});
- name: Build Package
run: |
set -e
hatch build
- name: Upload to PyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_KEY }}
run: |
set -e
# preflight check
python -m twine check dist/*
python -m twine upload dist/*