From d1e0a06ebd0b15d0c03619a98d565e8ddfdcf7c6 Mon Sep 17 00:00:00 2001
From: Ben Busby <noreply+git@benbusby.com>
Date: Tue, 31 Aug 2021 09:34:28 -0600
Subject: [PATCH] Move timestamp for dev builds into build process

---
 .github/workflows/pypi.yml | 4 ++--
 setup.py                   | 3 +--
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml
index c0d398f..44f4bcf 100644
--- a/.github/workflows/pypi.yml
+++ b/.github/workflows/pypi.yml
@@ -18,6 +18,8 @@ jobs:
         pip install
         build
         --user
+    - name: Set dev timestamp
+      run: echo "DEV_BUILD=$(date +%s)" >> $GITHUB_ENV
     - name: Build binary wheel and source tarball
       run: >-
         python -m
@@ -26,8 +28,6 @@ jobs:
         --wheel
         --outdir dist/
         .
-      env:
-        DEV_BUILD: 1
     - name: Publish distribution to TestPyPI
       uses: pypa/gh-action-pypi-publish@master
       with:
diff --git a/setup.py b/setup.py
index e9cbf88..0d9e9fa 100644
--- a/setup.py
+++ b/setup.py
@@ -1,6 +1,5 @@
 import os
 import setuptools
-import time
 
 long_description = open('README.md', 'r').read()
 
@@ -8,7 +7,7 @@ requirements = list(open('requirements.txt', 'r'))
 
 optional_dev_tag = ''
 if os.getenv('DEV_BUILD'):
-    optional_dev_tag = '.dev' + str(int(time.time()))
+    optional_dev_tag = '.dev' + os.getenv('DEV_BUILD')
 
 setuptools.setup(
     author='Ben Busby',