Skip to content

Commit

Permalink
Merge branch 'feature-8'
Browse files Browse the repository at this point in the history
  • Loading branch information
jaymoulin committed Mar 14, 2019
2 parents abc8a36 + 9c7d127 commit 0858f31
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 9 deletions.
13 changes: 10 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
FROM python:alpine3.6 as builder
FROM python:alpine as builder

COPY qemu-*-static /usr/bin/

FROM builder

ARG VERSION=0.3.2
ARG VERSION=0.4.0
LABEL maintainer="Jay MOULIN <jaymoulin@gmail.com> <https://twitter.com/MoulinJay>"
LABEL version=${VERSION}

RUN pip install -U pip && pip install github-release-notifier
COPY . /app
WORKDIR /app

RUN pip install -U pip && \
pip install -e . && \
mkdir -p ${HOME}/.github_release_notifier && \
touch ${HOME}/.github_release_notifier/versions

COPY ./entrypoint.sh /bin/entrypoint
COPY ./mycron.sh /bin/mycron
ENTRYPOINT ["/bin/entrypoint"]
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION ?= 0.3.3
VERSION ?= 0.4.0
CACHE ?= --no-cache=1
FULLVERSION ?= ${VERSION}
archs ?= arm32v7 amd64 i386 arm64v8 arm32v6
Expand All @@ -24,7 +24,7 @@ build-docker:
cp -r /usr/bin/qemu-*-static .
$(foreach arch,$(archs), \
cat Dockerfile | sed "s/FROM python:alpine/FROM ${arch}\/python:alpine/g" > .Dockerfile; \
docker build -t femtopixel/github-release-notifier:${VERSION}-$(arch) --build-arg VERSION=${VERSION} -f .Dockerfile ${CACHE} .;\
docker build -t femtopixel/github-release-notifier:${VERSION}-$(arch) --build-arg VERSION=${VERSION}-$(arch) -f .Dockerfile ${CACHE} .;\
)
publish-docker:
docker push femtopixel/github-release-notifier
Expand Down
10 changes: 10 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,16 @@ To automate this process, we could add this process in a cronjob:
This will check every day at midnight if new versions have been released.

Configuration
-------------

Environment variables can be defined to change default `hooks` or `versions` database files (plain json file)

.. code::
GRN_VERSIONS_FILE: Path to saved versions (default: ${HOME}/.github_release_notifier/versions)
GRN_HOOKS_FILE: Path to hooks configuration (default: ${HOME}/.github_release_notifier/hooks)
Docker Usage
------------

Expand Down
2 changes: 1 addition & 1 deletion github_release_notifier/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
"""

__all__ = ['parser', 'webhook', 'notifier']
__version__ = '0.3.3'
__version__ = '0.4.0'
4 changes: 2 additions & 2 deletions github_release_notifier/notifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from .parser import parse
from pathlib import Path

__DEFAULT_FILE__ = str(Path.home()) + '/.github_release_notifier/versions'
__DEFAULT_FILE__ = os.getenv('GRN_VERSIONS_FILE', str(Path.home()) + '/.github_release_notifier/versions')


def version_compare(version1: str, version2: str) -> int:
Expand All @@ -26,7 +26,7 @@ def _call_webhook(webhook: str, entry: str, logger: logging.Logger) -> None:
try:
requests.post(webhook, json=entry)
except requests.exceptions.RequestException:
logger.error("Error occured : %s" % (sys.exc_info()[0]))
logger.error("Error occurred : %s" % (sys.exc_info()[0]))


def run(file: str = __DEFAULT_FILE__) -> dict:
Expand Down
2 changes: 1 addition & 1 deletion github_release_notifier/webhook.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from typing import KeysView

__SALT__ = 'saltedUnique'
__DEFAULT_FILE__ = str(Path.home()) + '/.github_release_notifier/hooks'
__DEFAULT_FILE__ = os.getenv('GRN_HOOKS_FILE', str(Path.home()) + '/.github_release_notifier/hooks')


def _get_database(file: str = __DEFAULT_FILE__) -> dict:
Expand Down

0 comments on commit 0858f31

Please sign in to comment.