Skip to content

Commit

Permalink
Adding support for nightly builds
Browse files Browse the repository at this point in the history
  • Loading branch information
dfm authored and brandonwillard committed Dec 13, 2021
1 parent bca9a38 commit 6fce270
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Nightly
on:
schedule:
- cron: "0 0 * * *"

jobs:
build_and_publish:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-python@v2
with:
python-version: "3.9"
- name: Install dependencies
run: |
python -m pip install -U pip
python -m pip install build
- name: Build the sdist
run: python -m build --sdist .
env:
BUILD_AESARA_NIGHTLY: true
- uses: pypa/gh-action-pypi-publish@v1.4.2
with:
user: __token__
password: ${{ secrets.nightly_pypi_secret }}
20 changes: 20 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env python
import os
import sys

from setuptools import find_packages, setup
Expand Down Expand Up @@ -59,13 +60,32 @@ def read_file(filename):
if sys.version_info[0:2] < (3, 7):
install_requires += ["dataclasses"]

# Handle builds of nightly release
if "BUILD_AESARA_NIGHTLY" in os.environ:
nightly = True
NAME += "-nightly"

from versioneer import get_versions as original_get_versions

def get_versions():
from datetime import datetime, timezone

suffix = datetime.now(timezone.utc).strftime(r".dev%Y%m%d")
versions = original_get_versions()
versions["version"] = versions["version"].split("+")[0] + suffix
return versions

versioneer.get_versions = get_versions


if __name__ == "__main__":
setup(
name=NAME,
version=versioneer.get_version(),
cmdclass=versioneer.get_cmdclass(),
description=DESCRIPTION,
long_description=LONG_DESCRIPTION,
long_description_content_type="text/x-rst",
classifiers=CLASSIFIERS,
author=AUTHOR,
author_email=AUTHOR_EMAIL,
Expand Down

0 comments on commit 6fce270

Please sign in to comment.