Skip to content

Commit 6fce270

Browse files
dfmbrandonwillard
authored andcommitted
Adding support for nightly builds
1 parent bca9a38 commit 6fce270

File tree

2 files changed

+48
-0
lines changed

2 files changed

+48
-0
lines changed

.github/workflows/nightly.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Nightly
2+
on:
3+
schedule:
4+
- cron: "0 0 * * *"
5+
6+
jobs:
7+
build_and_publish:
8+
name: Build source distribution
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v2
12+
with:
13+
fetch-depth: 0
14+
- uses: actions/setup-python@v2
15+
with:
16+
python-version: "3.9"
17+
- name: Install dependencies
18+
run: |
19+
python -m pip install -U pip
20+
python -m pip install build
21+
- name: Build the sdist
22+
run: python -m build --sdist .
23+
env:
24+
BUILD_AESARA_NIGHTLY: true
25+
- uses: pypa/[email protected]
26+
with:
27+
user: __token__
28+
password: ${{ secrets.nightly_pypi_secret }}

setup.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#!/usr/bin/env python
2+
import os
23
import sys
34

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

63+
# Handle builds of nightly release
64+
if "BUILD_AESARA_NIGHTLY" in os.environ:
65+
nightly = True
66+
NAME += "-nightly"
67+
68+
from versioneer import get_versions as original_get_versions
69+
70+
def get_versions():
71+
from datetime import datetime, timezone
72+
73+
suffix = datetime.now(timezone.utc).strftime(r".dev%Y%m%d")
74+
versions = original_get_versions()
75+
versions["version"] = versions["version"].split("+")[0] + suffix
76+
return versions
77+
78+
versioneer.get_versions = get_versions
79+
80+
6281
if __name__ == "__main__":
6382
setup(
6483
name=NAME,
6584
version=versioneer.get_version(),
6685
cmdclass=versioneer.get_cmdclass(),
6786
description=DESCRIPTION,
6887
long_description=LONG_DESCRIPTION,
88+
long_description_content_type="text/x-rst",
6989
classifiers=CLASSIFIERS,
7090
author=AUTHOR,
7191
author_email=AUTHOR_EMAIL,

0 commit comments

Comments
 (0)