Skip to content

Build and upload to pypi #8

Build and upload to pypi

Build and upload to pypi #8

Workflow file for this run

name: Build and upload to pypi
on:
release:
types:
- created
jobs:
build:
runs-on: ubuntu-latest
permissions:
# This permission is required for trusted publishing.
id-token: write
contents: read
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up python
id: setup-python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
- name: Install dependencies
run: poetry install --no-interaction --no-root --with=dev,ci
- name: Check Schema Hash with upstream
run: |
source .venv/bin/activate
python scripts/checkUpstreamSchema.py
- name: Run tests
env:
REPORT_OUTPUT: md_report.md
shell: bash
run: |
source .venv/bin/activate
echo "REPORT_FILE=${REPORT_OUTPUT}" >> "$GITHUB_ENV"
pytest -v --md-report --md-report-flavor gfm --md-report-exclude-outcomes passed skipped xpassed --md-report-output "$REPORT_OUTPUT"
- name: Output reports to the job summary when tests fail
if: failure()
shell: bash
run: |
if [ -f "$REPORT_FILE" ]; then
echo "<details><summary>Failed Test Report</summary>" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
cat "$REPORT_FILE" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "</details>" >> $GITHUB_STEP_SUMMARY
fi
- name: Mint token
id: mint
uses: tschm/token-mint-action@v1.0.2
- name: Publish to PyPI
run: |
poetry publish --build -u __token__ -p '${{ steps.mint.outputs.api-token }}'