diff --git a/.github/workflows/binaries-nightly-release.yml b/.github/workflows/binaries-nightly-release.yml new file mode 100644 index 000000000000..e919da4499e6 --- /dev/null +++ b/.github/workflows/binaries-nightly-release.yml @@ -0,0 +1,49 @@ +name: Nightly Releases + +on: + # https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-syntax-for-github-actions#onschedule + schedule: + # Run at 00:00 UTC Every Day + - cron: '0 0 * * *' + + +jobs: + build-publish: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Setup Miniconda + uses: conda-incubator/setup-miniconda@v2 + with: + miniconda-version: "latest" + python-version: 3.7 + + - name: Setup nightly version + run: | + sed -i "s/__version__ = \"\(.*\)\"/__version__ = \"\1.dev$(date -u +%Y%m%d)\"/g" ignite/__init__.py + cat ignite/__init__.py + + - name: Install dependencies + shell: bash -l {0} + run: | + conda install -y pytorch torchvision cpuonly -c pytorch-nightly + pip install -r requirements-dev.txt + pip install --upgrade --no-cache-dir twine + python setup.py install + + - name: Build and Publish Conda binaries + shell: bash -l {0} + env: + ANACONDA_TOKEN: ${{ secrets.ANACONDA_TOKEN }} + UPLOAD_USER: "pytorch-nightly" + run: | + chmod +x ./conda.recipe/build_and_upload.sh + ./conda.recipe/build_and_upload.sh + + - name: Build and Publish PyPi binaries + shell: bash -l {0} + run: | + python setup.py sdist bdist_wheel + twine check dist/* + TWINE_USERNAME="${{ secrets.PYPI_USER }}" TWINE_PASSWORD="${{ secrets.PYPI_TOKEN }}" twine upload --verbose dist/* diff --git a/conda.recipe/build_and_upload.sh b/conda.recipe/build_and_upload.sh new file mode 100644 index 000000000000..46727f6e40fe --- /dev/null +++ b/conda.recipe/build_and_upload.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +echo "Build and upload Conda binaries" + +# ANACONDA_TOKEN should be provided +# How to generate ANACONDA_TOKEN: https://docs.anaconda.com/anaconda-cloud/user-guide/tasks/work-with-accounts#creating-access-tokens +# https://conda.io/docs/user-guide/tasks/build-packages/install-conda-build.html + +if [ -z $ANACONDA_TOKEN ]; then + echo "Can not find ANACONDA_TOKEN env variable" + echo "Please, export ANACONDA_TOKEN= before calling this script" + exit 1 +fi + +if [ -z $UPLOAD_USER ]; then + echo "Can not find UPLOAD_USER env variable" + echo "Please, export UPLOAD_USER= before calling this script" + exit 1 +fi + +set -xeu + +conda install -y conda-build conda-verify anaconda-client +conda config --set anaconda_upload no + +conda build --quiet --no-test --output-folder conda_build conda.recipe -c pytorch + +# Convert to other platforms: OSX, WIN +conda convert --platform win-64 conda_build/linux-64/*.tar.bz2 -o conda_build/ +conda convert --platform osx-64 conda_build/linux-64/*.tar.bz2 -o conda_build/ + +# Upload to Anaconda +# We could use --all but too much platforms to uploaded +ls conda_build/*/*.tar.bz2 | xargs -I {} anaconda -v -t $ANACONDA_TOKEN upload -u $UPLOAD_USER {} \ No newline at end of file