- fix macos ci #5
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: publish-pypi | |
on: | |
push: | |
tags: | |
- '*' | |
jobs: | |
build-n-publish: | |
name: Build and publish to PyPi | |
runs-on: ubuntu-18.04 | |
steps: | |
- uses: actions/checkout@master | |
- name: Set up Python 3.7 | |
uses: actions/setup-python@v1 | |
with: | |
python-version: 3.7 | |
- name: bump_version | |
run: | | |
export REFS_VERSION=${{ github.ref }} | |
export VERSION=$(echo $REFS_VERSION| cut -d'/' -f 3) | |
echo $VERSION | |
sed -i -E "1,/[0-9]+.[0-9]+.[0-9]+/ s/[0-9]+.[0-9]+.[0-9]+/$VERSION/g" pypi/setup.py | |
git config user.name github-actions | |
git config user.email github-actions@github.com | |
git add . | |
git commit -m "- bump pypi/setup.py version to $VERSION for publish" | |
git push origin HEAD:master | |
- name: Install pep517 | |
run: >- | |
python -m | |
pip install | |
pep517 | |
--user | |
- name: Build a binary wheel and a source tarball | |
run: | | |
echo ${{github.event.ref}} | |
cd pypi | |
mkdir jsn | |
cd .. | |
cp jsn.py pypi/jsn/__init__.py | |
cp readme.md pypi/readme.md | |
cp license pypi/license | |
cd pypi | |
python -m pep517.build --source --binary --out-dir dist/ . | |
- name: Publish distribution 📦 to Test PyPI | |
if: startsWith(github.event.ref, 'refs/heads/pypi-test') | |
uses: pypa/gh-action-pypi-publish@master | |
with: | |
password: ${{ secrets.test_pypi_password }} | |
repository_url: https://test.pypi.org/legacy/ | |
packages_dir: pypi/dist | |
- name: Publish distribution 📦 to PyPI | |
uses: pypa/gh-action-pypi-publish@master | |
with: | |
password: ${{ secrets.pypi_password }} | |
packages_dir: pypi/dist |