Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add release automation #22

Merged
merged 2 commits into from
Jul 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .github/workflows/default.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
on:
push:
tags:
- "v*.*.*"
branches:
- main
pull_request: {}

jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.x'
- run: python3 -m pip install --upgrade build twine
- name: build package
run: |
export VERSION=0.0.0
[[ "$GITHUB_REF" == "refs/tags/"* ]] && VERSION="${GITHUB_REF/refs\/tags\/v/}"
python3 -m build
- uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.TWINE_PASSWORD }}
if: startsWith(github.ref, 'refs/tags/')
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ diambraArena/mame/cfg
.ipynb*
trajRecordings/*
__pycache*
dist/
20 changes: 20 additions & 0 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Development

## Release
- Bump version in setup.py
- Install build and twine:
```
python3 -m pip install --upgrade build
python3 -m pip install --upgrade twine
```
- Create `~/.pypirc`:
```
[pypi]
username = __token__
password = pypi-XXX
```
- Build and upload package:
```
python3 -m build
python3 -m twine upload --repository pypi dist/*
```
45 changes: 20 additions & 25 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,5 @@
from setuptools import find_packages
from diambra.arena import __version__
import setuptools
import sys
import os

# Check if docker is installed
if os.system("docker ps") != 0:
print("---")
print("ERROR: It seems docker is not installed in your system.")
print("It is required to use DIAMBRA Arena.")
print("Install it from https://docs.docker.com/get-docker/")
print("---")
sys.exit(1)
else:
print("Downloading DIAMBRA Docker image")
# TODO: decomment
# os.system("docker pull diambra/diambraApp:main")
import setuptools, os
from pathlib import Path

try:
from pip import main as pipmain
Expand All @@ -25,7 +9,7 @@
pipmain(['install', 'setuptools'])
pipmain(['install', 'distro'])

extras = {
extras= {
'core': []
}

Expand All @@ -34,13 +18,13 @@
setuptools.setup(
name='diambra-arena',
url='https://github.com/diambra/arena',
version=__version__,
version=os.environ.get('VERSION', '0.0.0'),
author="DIAMBRA Team",
author_email="info@diambra.ai",
description="DIAMBRA™ Arena. Built with OpenAI Gym Python interface, easy to use,\ntransforms popular video games into Reinforcement Learning environments",
long_description="DIAMBRA™ Arena. Built with OpenAI Gym Python interface, easy to use,\ntransforms popular video games into Reinforcement Learning environments",
long_description_content_type="Reinforcement Learning",
license='GNU Affero GPL',
long_description = (Path(__file__).parent / "README.md").read_text(),
long_description_content_type="text/markdown",
license='Custom',
install_requires=[
'pip>=21',
'setuptools',
Expand All @@ -55,8 +39,19 @@
'opencv-python>=4.4.0.42',
'grpcio',
'grpcio-tools'],
packages=[package for package in find_packages(
packages=[package for package in setuptools.find_packages(
) if package.startswith("diambra")],
include_package_data=True,
extras_require=extras
extras_require=extras,
classifiers=[
'Development Status :: 3 - Alpha',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Topic :: Scientific/Engineering :: Artificial Intelligence',
'Topic :: Scientific/Engineering :: Artificial Life',
'Topic :: Games/Entertainment',
'Topic :: Games/Entertainment :: Arcade',
'Topic :: Education',
]
)