Skip to content
This repository has been archived by the owner on Feb 22, 2024. It is now read-only.

Commit

Permalink
Merge pull request #6 from NeonGeckoCom/dev
Browse files Browse the repository at this point in the history
Add Github Automation (#5)
  • Loading branch information
NeonDaniel authored Sep 15, 2021
2 parents 601a962 + 0a5d268 commit 2375122
Show file tree
Hide file tree
Showing 6 changed files with 154 additions and 1 deletion.
40 changes: 40 additions & 0 deletions .github/workflows/publish_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# This workflow will generate a release distribution and upload it to PyPI

name: Publish Build and GitHub Release
on:
push:
branches:
- master

jobs:
tag_release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Get Version
run: |
VERSION=$(python setup.py --version)
echo "VERSION=${VERSION}" >> $GITHUB_ENV
- uses: ncipollo/release-action@v1
with:
token: ${{secrets.GITHUB_TOKEN}}
tag: ${{env.VERSION}}
build_and_publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup Python
uses: actions/setup-python@v1
with:
python-version: 3.8
- name: Install Build Tools
run: |
python -m pip install build wheel
- name: Build Distribution Packages
run: |
python setup.py bdist_wheel
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{secrets.PYPI_TOKEN}}
39 changes: 39 additions & 0 deletions .github/workflows/publish_test_build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# This workflow will generate a distribution and upload it to PyPI

name: Publish Alpha Build
on:
push:
branches:
- dev
paths-ignore:
- 'version.py'

jobs:
build_and_publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}
- name: Setup Python
uses: actions/setup-python@v1
with:
python-version: 3.8
- name: Install Build Tools
run: |
python -m pip install build wheel
- name: Increment Version
run: |
VER=$(python setup.py --version)
python version_bump.py
- name: Push Version Change
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Increment Version
- name: Build Distribution Packages
run: |
python setup.py bdist_wheel
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{secrets.PYPI_TOKEN}}
21 changes: 21 additions & 0 deletions .github/workflows/pull_master.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# This workflow will generate a PR for changes in cert into master

name: Pull to Master
on:
push:
branches:
- dev
workflow_dispatch:

jobs:
pull_changes:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: pull-request-action
uses: repo-sync/pull-request@v2
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
pr_reviewer: 'neonreviewers'
pr_assignee: 'neondaniel'
pr_draft: true
2 changes: 2 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ def get_requirements(requirements_filename: str):
name='neon-tts-plugin-mozilla_remote',
version=version,
description='A Mozilla TTS plugin for Neon',
long_description=long_description,
long_description_content_type='text/markdown',
url='https://github.com/NeonGeckoCom/neon-tts-plugin-mozilla_remote',
author='Neongecko',
author_email='developers@neon.ai',
Expand Down
2 changes: 1 addition & 1 deletion version.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
# USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

__version__ = "0.0.2"
__version__ = "0.1.0"
51 changes: 51 additions & 0 deletions version_bump.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# NEON AI (TM) SOFTWARE, Software Development Kit & Application Development System
# All trademark and other rights reserved by their respective owners
# Copyright 2008-2021 Neongecko.com Inc.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
# 3. Neither the name of the copyright holder nor the names of its
# contributors may be used to endorse or promote products derived from this
# software without specific prior written permission.
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
# OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

import fileinput
from os.path import join, dirname

with open(join(dirname(__file__), "version.py"), "r", encoding="utf-8") as v:
for line in v.readlines():
if line.startswith("__version__"):
if '"' in line:
version = line.split('"')[1]
else:
version = line.split("'")[1]

if "a" not in version:
parts = version.split('.')
parts[-1] = str(int(parts[-1]) + 1)
version = '.'.join(parts)
version = f"{version}a0"
else:
post = version.split("a")[1]
new_post = int(post) + 1
version = version.replace(f"a{post}", f"a{new_post}")

for line in fileinput.input(join(dirname(__file__), "version.py"), inplace=True):
if line.startswith("__version__"):
print(f"__version__ = \"{version}\"")
else:
print(line.rstrip('\n'))

0 comments on commit 2375122

Please sign in to comment.