github acttions #2
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: facebookresearch/nevergrad/release | ||
on: | ||
push: | ||
tags: | ||
- '[0-9]+.[0-9]+.[0-9]+' | ||
- '[0-9]+.[0-9]+.[0-9]+.post[0-9]+' | ||
env: | ||
PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }} | ||
CIRCLE_TAG: ${{ github.ref_name }} | ||
jobs: | ||
pypi-deploy: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.9' | ||
- uses: actions/[email protected] | ||
- uses: "./.github/actions/ubuntu_restore_all" | ||
- name: Run wheel and check package | ||
run: | | ||
. venv/bin/activate | ||
pip install wheel | ||
rm -rf dist # make sure it's clean | ||
echo "Creating sdist" | ||
python setup.py sdist | ||
echo "Created sdist, now creating wheel" | ||
python setup.py bdist_wheel | ||
echo "Created wheel" | ||
mkdir nevergrad-build | ||
mv dist nevergrad-build/ | ||
- name: Create .pypirc | ||
run: | | ||
if [[ $GITHUB_REF =~ ^refs/tags//(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(\.post(0|[1-9][0-9]*))?/$ && $GITHUB_REF != 'refs/heads//.*/' ]]; then | ||
echo -e "[pypi]" >> ~/.pypirc | ||
echo -e "username = __token__" >> ~/.pypirc | ||
echo -e "password = $PYPI_PASSWORD" >> ~/.pypirc | ||
fi | ||
- name: Verify tag | ||
run: python setup.py verify_circleci_version | ||
- name: upload to pypi | ||
run: | | ||
echo "Deploying" | ||
. venv/bin/activate | ||
du -h nevergrad-build/dist/* | ||
twine check nevergrad-build/dist/nevergrad-* | ||
twine upload nevergrad-build/dist/nevergrad-* --verbose | ||
fi |