Skip to content

Commit

Permalink
add versioneer action (#340)
Browse files Browse the repository at this point in the history
* resolves #339

* adapt for no toml & Py310

* explicitly use Py310

* adjust setup.py

* trigger action run

* try again w/3.11
  • Loading branch information
jGaboardi authored Jan 13, 2023
1 parent f2ac58f commit 1dadd08
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 3 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/versioneer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# See https://github.com/python-versioneer/python-versioneer
name: "Update Versioneer"
on:
workflow_dispatch:
inputs:
version:
description: Manual Versioneer Run
default: test
required: false
schedule:
- cron: "0 6 1 * *" # 1st day of each month at 06:00 UTC
push:
paths:
- "setup.cfg"
- ".github/workflows/versioneer.yml"

jobs:
versioneer:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install and run versioneer
run: |
pip install versioneer
versioneer install
- name: Blacken code
uses: psf/black@stable
with:
options: "--verbose"
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
path: versioneer.py
- name: Ignore changes in __init__
run: |
git reset -- spopt/__init__.py
git checkout -- spopt/__init__.py
- name: Create PR
uses: peter-evans/create-pull-request@v4
with:
title: "Update Versioneer"
branch: update-versioneer
base: main
commit-message: "[Bot] Update Versioneer"

body: |
Automatic update of Versioneer by the `versioneer.yml` workflow.
5 changes: 2 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from setuptools import setup, find_packages
from distutils.command.build_py import build_py
import versioneer

package = "spopt" # name of package
Expand Down Expand Up @@ -34,9 +33,9 @@ def setup_package():
extras_reqs = reqs

setup(
name=package,
name=package, # needed by GitHub dependency graph
version=versioneer.get_version(),
cmdclass=versioneer.get_cmdclass({"build_py": build_py}),
cmdclass=versioneer.get_cmdclass(),
description="Spatial Optimization in PySAL",
long_description=long_description,
long_description_content_type="text/markdown",
Expand Down

0 comments on commit 1dadd08

Please sign in to comment.