49 lines
1.5 KiB
YAML
49 lines
1.5 KiB
YAML
name: "CI for pypl publish"
|
|
on:
|
|
push:
|
|
branches:
|
|
- master # publish release on master
|
|
- develop # publish snapshot on develop
|
|
- "feat/*" # test
|
|
workflow_dispatch:
|
|
# allow manual trigger
|
|
env:
|
|
DEBIAN_FRONTEND: noninteractive
|
|
TZ: UTC
|
|
jobs:
|
|
publish-lib:
|
|
runs-on: default
|
|
container:
|
|
image: ubuntu:24.04
|
|
steps:
|
|
# need to setup node and git
|
|
- run: |
|
|
apt-get update
|
|
apt-get install -y nodejs git libsqlite3-0
|
|
# check out code
|
|
- uses: actions/checkout@v4
|
|
- uses: https://github.com/actions/setup-python@v5
|
|
with:
|
|
python-version: '3.11'
|
|
# install dependencies
|
|
- run: pip install -e .[dev]
|
|
# run pytest
|
|
- run: pytest
|
|
# replace timestamp building dev version
|
|
- name: Add timestamp to version
|
|
if: github.head_ref != '' && github.head_ref != 'master'
|
|
run: |
|
|
sed -i -E "s/(version = \"[^\"]+)(-dev)DT\"/\1\2$(date -u +'%Y%m%d%H%M%S')\"/" pyproject.toml
|
|
cat pyproject.toml
|
|
- name: Build wheel
|
|
run: |
|
|
python -m build
|
|
# publish
|
|
- run: |
|
|
twine upload --repository-url https://git.cleverthis.com/api/packages/clevermicro/pypi \
|
|
--username $CI_REGISTRY_USER \
|
|
--password $CI_REGISTRY_PASSWORD \
|
|
dist/*
|
|
env:
|
|
CI_REGISTRY_USER: ${{ secrets.REGISTRY_USER }}
|
|
CI_REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }} |