Skip to content

Commit

Permalink
Task for cleaning release artifacts
Browse files Browse the repository at this point in the history
  • Loading branch information
Xion committed Dec 31, 2016
1 parent 811aecb commit a3190d7
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
22 changes: 21 additions & 1 deletion tasks/release/__init__.py
@@ -1,11 +1,18 @@
"""
Release tasks.
Tasks for preparing release bundles for various platform.
Actual _deployment_ of those releases (e.g. as GitHub Releases)
is NOT handled here.
"""
from pathlib import Path
import shutil

from invoke import Collection, task


RELEASE_DIR = Path.cwd() / 'release'


@task(name="all")
def all_(ctx):
"""Create all release packages."""
Expand All @@ -19,10 +26,23 @@ def all_(ctx):
rpm(ctx)


@task
def clean(ctx):
"""Clean up release artifacts."""
if RELEASE_DIR.is_dir():
try:
shutil.rmtree(str(RELEASE_DIR))
except (OSError, shutil.Error) as e:
logging.warning("Error while cleaning release dir: %s", e)
else:
RELEASE_DIR.mkdir()


# Task setup

ns = Collection()
ns.add_task(all_, default=True)
ns.add_task(clean)

# Import every task from submodules directly into the root task namespace
# (without creating silly qualified names like `release.fpm.deb`
Expand Down
4 changes: 3 additions & 1 deletion tasks/release/fpm.py
Expand Up @@ -18,6 +18,8 @@
from invoke.exceptions import Exit
import toml

from tasks.release import RELEASE_DIR


# Package information.
#
Expand All @@ -35,7 +37,7 @@
SOURCE_DIR = Path.cwd() / 'target' / 'release'
BIN = 'gisht'
EXTRA_FILES = ['LICENSE', 'README.md']
OUTPUT_DIR = Path.cwd() / 'release'
OUTPUT_DIR = RELEASE_DIR

# Directory where the binary should be installed on Linux systems.
LINUX_INSTALL_DIR = '/usr/bin'
Expand Down

0 comments on commit a3190d7

Please sign in to comment.