Skip to content

process shape partly out of page; ignore replacement character `\ufff… #32

process shape partly out of page; ignore replacement character `\ufff…

process shape partly out of page; ignore replacement character `\ufff… #32

Workflow file for this run

# Create release and publish to Pypi when pushing tags
name: publish
# Trigger the workflow on push tags, matching vM.n.p, i.e. v3.2.10
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
# Jobs to do:
# - build package
# - create release with asset
# - publish to Pypi
jobs:
# -----------------------------------------------------------
# create python env and setup package
# -----------------------------------------------------------
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Set up Python 3.x
uses: actions/setup-python@v1
with:
python-version: '3.10'
- name: Display Python version
run: python -c "import sys; print(sys.version)"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel pytest
# build package for tags, e.g. 3.2.1 extracted from 'refs/tags/v3.2.1'
- name: Build package
run: |
echo ${GITHUB_REF#refs/tags/v} > version.txt
python setup.py sdist --formats=gztar,zip
python setup.py bdist_wheel
# test wheel file locally
- name: Test package
run: |
pip install ./dist/*.whl
cd test
pytest -v test.py::TestConversion
# upload the artifacts for further jobs
# - app-tag.tar.gz
# - app-tag.zip
# - app-tag-info.whl
- name: Archive package
uses: actions/upload-artifact@v2
with:
name: dist
path: ./dist
# -----------------------------------------------------------
# create release and upload asset
# -----------------------------------------------------------
release:
runs-on: ubuntu-latest
# Run this job after build completes successfully
needs: build
steps:
- name: Checkout code
uses: actions/checkout@v2
# download artifacts from job: build
- name: Download artifacts from build
uses: actions/download-artifact@v2
with:
name: dist
path: dist
# create release and upload assets
- name: Create release with assets
uses: softprops/action-gh-release@v1
with:
files: |
./dist/*.tar.gz
./dist/*.zip
./dist/*.whl
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# -----------------------------------------------------------
# publish to Pypi
# -----------------------------------------------------------
publish:
runs-on: ubuntu-latest
# Run this job after both build and release completes successfully
needs: [build, release]
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Download artifacts from release
uses: actions/download-artifact@v2
with:
name: dist
path: dist
# Error when two sdist files created in build job are uploaded to Pipi:
# HTTPError: 400 Bad Request from https://upload.pypi.org/legacy/
# Only one sdist may be uploaded per release.
- name: Remove duplicated sdist
run: rm ./dist/*.zip
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.PYPI_PASSWORD }}