Add github action for releasing to pypi if git tag is added. (#727)
* Add github action for releasing to pypi if git tag is added. * Checkout code and fix typos. * Replace end with fi * Strictly numeric version for testing. * Remove obsolete Make commands for publishing * Also create GitHub release * Update pdfminer/__init__.py Co-authored-by: Jake Stockwin <jstockwin@gmail.com> * Remove test pypi release * Use maintained github action for releasing * Change tag format for versions * Undo commenting pypi publishing * Remove develop branch, since that will be removed in favor off adding tags for releases. * Change version regex Co-authored-by: Jake Stockwin <jstockwin@gmail.com>pull/730/head
parent
43c8fc8557
commit
d89cc357ee
|
@ -1,14 +1,14 @@
|
|||
name: Continuous integration
|
||||
|
||||
on:
|
||||
push: # run when commits are added to master or develop
|
||||
push: # run when commits are added to master
|
||||
branches:
|
||||
- master
|
||||
- develop
|
||||
pull_request: # run on pr's against master or develop
|
||||
tags:
|
||||
- [ 0-9 ]{ 8 } # match version tags with format like 20220319
|
||||
pull_request: # run on pr's against master
|
||||
branches:
|
||||
- master
|
||||
- develop
|
||||
|
||||
env:
|
||||
default-python: "3.10"
|
||||
|
@ -108,3 +108,48 @@ jobs:
|
|||
- name: Build docs
|
||||
run: |
|
||||
nox --error-on-missing-interpreters --non-interactive --session docs
|
||||
|
||||
publish:
|
||||
name: Publish to PyPi
|
||||
runs-on: ubuntu-latest
|
||||
needs:
|
||||
- check-code-formatting
|
||||
- check-coding-style
|
||||
- check-static-types
|
||||
- tests
|
||||
- build-docs
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
- name: Install dependencies
|
||||
run: python -m pip install wheel
|
||||
- name: Set version
|
||||
run: |
|
||||
if [[ "${{ github.ref }}" == "refs/tags/"* ]]
|
||||
then
|
||||
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,' | sed -e 's/^v//')
|
||||
else
|
||||
VERSION=$(date +%Y%m%d).$(date +%H%M%S)
|
||||
fi
|
||||
echo ${VERSION}
|
||||
sed -i "s/__VERSION__/${VERSION}/g" pdfminer/__init__.py
|
||||
- name: Build package
|
||||
run: python setup.py sdist bdist_wheel
|
||||
- name: Generate changelog
|
||||
run: sed '1,/## \[/d;/## \[/Q' CHANGELOG.md > ${{ github.workspace }}-CHANGELOG.md
|
||||
- name: Publish package to PyPi
|
||||
if: startsWith(github.ref, 'refs/tags')
|
||||
uses: pypa/gh-action-pypi-publish@release/v1
|
||||
with:
|
||||
user: __token__
|
||||
password: ${{ secrets.PYPI_API_TOKEN }}
|
||||
- name: Create GitHub release
|
||||
if: startsWith(github.ref, 'refs/tags')
|
||||
uses: softprops/action-gh-release@v1
|
||||
id: create_release
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
|
||||
body_path: ${{ github.workspace }}-CHANGELOG.md
|
||||
files: |
|
||||
dist/*.tar.gz
|
||||
dist/*.whl
|
|
@ -27,7 +27,7 @@ Any contribution is appreciated! You might want to:
|
|||
## Guideline for creating pull request
|
||||
|
||||
* A pull request should close an existing issue.
|
||||
* Pull requests should be merged to develop, not master. This ensures that master always equals the released version.
|
||||
* Pull requests should be merged to master. Version tags are used indicate the releases.
|
||||
* Include unit tests when possible. In case of bugs, this will help to prevent the same mistake in the future. In case
|
||||
of features, this will show that your code works correctly.
|
||||
* Code should work for Python 3.6+.
|
||||
|
|
26
Makefile
26
Makefile
|
@ -1,37 +1,11 @@
|
|||
## Makefile (for maintenance purpose)
|
||||
##
|
||||
|
||||
PACKAGE=pdfminer
|
||||
|
||||
PYTHON=python
|
||||
GIT=git
|
||||
RM=rm -f
|
||||
CP=cp -f
|
||||
MKDIR=mkdir
|
||||
|
||||
all:
|
||||
|
||||
install:
|
||||
$(PYTHON) setup.py install --home=$(HOME)
|
||||
|
||||
clean:
|
||||
-$(PYTHON) setup.py clean
|
||||
-$(RM) -r build dist MANIFEST
|
||||
-cd $(PACKAGE) && $(MAKE) clean
|
||||
-cd tools && $(MAKE) clean
|
||||
-cd samples && $(MAKE) clean
|
||||
|
||||
distclean: clean cmap_clean
|
||||
|
||||
sdist: distclean MANIFEST.in
|
||||
$(PYTHON) setup.py sdist
|
||||
register: distclean MANIFEST.in
|
||||
$(PYTHON) setup.py sdist upload register
|
||||
|
||||
WEBDIR=../euske.github.io/$(PACKAGE)
|
||||
publish:
|
||||
$(CP) docs/*.html docs/*.png docs/*.css $(WEBDIR)
|
||||
|
||||
CONV_CMAP=$(PYTHON) tools/conv_cmap.py
|
||||
CMAPSRC=cmaprsrc
|
||||
CMAPDST=pdfminer/cmap
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
# Makefile for pdfminer
|
||||
|
||||
RM=rm -f
|
||||
|
||||
all:
|
||||
|
||||
clean:
|
||||
-$(RM) *.pyc *.pyo
|
||||
cd cmap && make clean
|
|
@ -1,4 +1,4 @@
|
|||
__version__ = "20211012"
|
||||
__version__ = "__VERSION__" # auto replaced with tag in github actions
|
||||
|
||||
if __name__ == "__main__":
|
||||
print(__version__)
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
# Makefile for tools
|
||||
|
||||
RM=rm -f
|
||||
|
||||
all:
|
||||
|
||||
clean:
|
||||
-$(RM) *.pyc *.pyo *.cgic *.cgio
|
Loading…
Reference in New Issue