Skip to content

Publish

Publish #160

Workflow file for this run

name: Publish
on:
release:
types: [created]
push:
branches: [dev]
pull_request:
branches: [master]
create:
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
os: [ubuntu-latest]
python-version: ["3.8"]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pytest setuptools wheel twine build
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Get release version
id: get_version
run: |
if [[ "$GITHUB_REF" == refs/tags/* ]]; then
VERSION=${GITHUB_REF#refs/tags/}
echo "Release version: $VERSION"
echo ::set-output name=VERSION::$VERSION
else
echo "Not a release tag. Exiting."
exit 1
fi
- name: Update setup.py version
run: |
VERSION=${{ steps.get_version.outputs.VERSION }}
sed -i "s/version='0.0.0'/version='$VERSION'/" setup.py
- name: Build and test
run: |
python -m build
pip install dist/article_parser-*.whl
pytest --disable-warnings
# - name: Test Publish
# uses: pypa/gh-action-pypi-publish@release/v1
# if: github.event_name == 'release' && github.event.action == 'created'
# with:
# user: __token__
# password: ${{ secrets.TEST_PYPI_API_TOKEN }}
# repository-url: https://test.pypi.org/legacy/
# skip-existing: true
# verbose: true
- name: Publish
uses: pypa/gh-action-pypi-publish@release/v1
if: github.event_name == 'create' && github.event.ref_type == 'tag'
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
skip-existing: true
verbose: true