Skip to content
This repository was archived by the owner on Aug 19, 2025. It is now read-only.

Commit ac4ce9b

Browse files
Publish workflow (#200)
* Publish workflow * Set PYTHONPATH to allow auto docs to import package
1 parent 5cccb5c commit ac4ce9b

File tree

3 files changed

+42
-16
lines changed

3 files changed

+42
-16
lines changed

.github/workflows/publish.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
name: Publish
3+
4+
on:
5+
push:
6+
tags:
7+
- '*'
8+
9+
jobs:
10+
publish:
11+
name: "Publish release"
12+
runs-on: "ubuntu-latest"
13+
14+
steps:
15+
- uses: "actions/checkout@v2"
16+
- uses: "actions/setup-python@v1"
17+
with:
18+
python-version: 3.7
19+
- name: "Publish"
20+
run: "scripts/publish"
21+
env:
22+
TWINE_USERNAME: __token__
23+
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}

.github/workflows/test-suite.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
name: Test Suite
33

44
on:
5-
push:
6-
branches: ["master"]
75
pull_request:
86
branches: ["master"]
97

scripts/publish

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,29 @@
11
#!/bin/sh -e
22

3-
export VERSION=`cat databases/__init__.py | grep __version__ | sed "s/__version__ = //" | sed "s/'//g"`
4-
export PREFIX=""
3+
VERSION_FILE="httpcore/__init__.py"
4+
PYTHONPATH=.
5+
56
if [ -d 'venv' ] ; then
6-
export PREFIX="venv/bin/"
7+
PREFIX="venv/bin/"
8+
else
9+
PREFIX=""
710
fi
811

9-
scripts/clean
12+
if [ ! -z "$GITHUB_ACTIONS" ]; then
13+
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
14+
git config --local user.name "GitHub Action"
15+
16+
VERSION=`grep __version__ ${VERSION_FILE} | grep -o '[0-9][^"]*'`
1017

11-
if ! command -v "${PREFIX}twine" &>/dev/null ; then
12-
echo "Unable to find the 'twine' command."
13-
echo "Install from PyPI, using '${PREFIX}pip install twine'."
18+
if [ "refs/tags/${VERSION}" != "${GITHUB_REF}" ] ; then
19+
echo "GitHub Ref '${GITHUB_REF}' did not match package version '${VERSION}'"
1420
exit 1
21+
fi
1522
fi
1623

17-
${PREFIX}python setup.py sdist
18-
${PREFIX}twine upload dist/*
24+
set -x
1925

20-
echo "You probably want to also tag the version now:"
21-
echo "git tag -a ${VERSION} -m 'version ${VERSION}'"
22-
echo "git push --tags"
23-
24-
scripts/clean
26+
${PREFIX}pip install twine wheel mkdocs mkdocs-material mkautodoc
27+
${PREFIX}python setup.py sdist bdist_wheel
28+
${PREFIX}twine upload dist/*
29+
${PREFIX}mkdocs gh-deploy --force

0 commit comments

Comments
 (0)