46 lines
1.3 KiB
YAML
46 lines
1.3 KiB
YAML
name: Python Package
|
|
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
secrets:
|
|
PIPY_REPO_USER:
|
|
required: true
|
|
PIPY_REPO_PASS:
|
|
required: true
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
if: ${{ hashFiles('test/*.py') != '' }}
|
|
steps:
|
|
- name: Setting up python
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: '3.11'
|
|
- name: Installing dependencies
|
|
run: python -m pip install --upgrade pip setuptools wheel pytest
|
|
- name: Check out repository code
|
|
uses: actions/checkout@v3
|
|
- name: Build
|
|
run: python3 -m build
|
|
- name: Test
|
|
run: pyest test
|
|
publish:
|
|
runs-on: ubuntu-latest
|
|
needs: [test]
|
|
steps:
|
|
- name: Setting up python
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: '3.x'
|
|
- name: Installing dependencies
|
|
run: python -m pip install --upgrade pip setuptools wheel build twine
|
|
- name: Check out repository code
|
|
uses: actions/checkout@v3
|
|
- name: Build
|
|
run: python3 -m build
|
|
- name: Publish
|
|
run: python3 -m twine upload --repository-url "https://gitea.example.com/api/packages/${{ secrets.PIPY_REPO_USER }}/pypi" -u ${{ secrets.PIPY_REPO_USER }} -p ${{ secrets.PIPY_REPO_PASS }} dist/*
|
|
|