Skip to content

Commit a4fb139

Browse files
committed
automations
1 parent b06706d commit a4fb139

13 files changed

+471
-2
lines changed

.github/FUNDING.yml

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
liberapay: jarbasAI

.github/workflows/dev2master.yml

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Push dev -> master
2+
on:
3+
workflow_dispatch:
4+
5+
jobs:
6+
build_and_publish:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v2
10+
with:
11+
fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository.
12+
ref: dev
13+
- name: Push dev -> master
14+
uses: ad-m/github-push-action@master
15+
16+
with:
17+
github_token: ${{ secrets.GITHUB_TOKEN }}
18+
branch: master

.github/workflows/publish_alpha.yml

+72
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# This workflow will generate a distribution and upload it to PyPI
2+
3+
name: Publish Alpha Build ...aX
4+
on:
5+
push:
6+
branches:
7+
- dev
8+
paths-ignore:
9+
- 'hivemind_webchat/version.py'
10+
- 'test/**'
11+
- 'examples/**'
12+
- '.github/**'
13+
- '.gitignore'
14+
- 'LICENSE'
15+
- 'CHANGELOG.md'
16+
- 'MANIFEST.in'
17+
- 'readme.md'
18+
- 'scripts/**'
19+
workflow_dispatch:
20+
21+
jobs:
22+
build_and_publish:
23+
runs-on: ubuntu-latest
24+
steps:
25+
- uses: actions/checkout@v2
26+
with:
27+
ref: dev
28+
fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository.
29+
- name: Setup Python
30+
uses: actions/setup-python@v1
31+
with:
32+
python-version: 3.8
33+
- name: Install Build Tools
34+
run: |
35+
python -m pip install build wheel
36+
- name: Increment Version
37+
run: |
38+
VER=$(python setup.py --version)
39+
python scripts/bump_alpha.py
40+
- name: "Generate release changelog"
41+
uses: heinrichreimer/[email protected]
42+
with:
43+
token: ${{ secrets.GITHUB_TOKEN }}
44+
id: changelog
45+
- name: Commit to dev
46+
uses: stefanzweifel/git-auto-commit-action@v4
47+
with:
48+
commit_message: Increment Version
49+
branch: dev
50+
- name: version
51+
run: echo "::set-output name=version::$(python setup.py --version)"
52+
id: version
53+
- name: Create Release
54+
id: create_release
55+
uses: actions/create-release@v1
56+
env:
57+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
58+
with:
59+
tag_name: V${{ steps.version.outputs.version }}
60+
release_name: Release ${{ steps.version.outputs.version }}
61+
body: |
62+
Changes in this Release
63+
${{ steps.changelog.outputs.changelog }}
64+
draft: false
65+
prerelease: true
66+
- name: Build Distribution Packages
67+
run: |
68+
python setup.py bdist_wheel
69+
- name: Publish to Test PyPI
70+
uses: pypa/gh-action-pypi-publish@master
71+
with:
72+
password: ${{secrets.PYPI_TOKEN}}

.github/workflows/publish_build.yml

+76
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# This workflow will generate a distribution and upload it to PyPI
2+
3+
name: Publish Build Release ..X
4+
on:
5+
workflow_dispatch:
6+
7+
jobs:
8+
build_and_publish:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v2
12+
with:
13+
ref: dev
14+
fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository.
15+
- name: Setup Python
16+
uses: actions/setup-python@v1
17+
with:
18+
python-version: 3.8
19+
- name: Install Build Tools
20+
run: |
21+
python -m pip install build wheel
22+
- name: Remove alpha (declare stable)
23+
run: |
24+
VER=$(python setup.py --version)
25+
python scripts/remove_alpha.py
26+
- name: "Generate release changelog"
27+
uses: heinrichreimer/[email protected]
28+
with:
29+
token: ${{ secrets.GITHUB_TOKEN }}
30+
id: changelog
31+
- name: Commit to dev
32+
uses: stefanzweifel/git-auto-commit-action@v4
33+
with:
34+
commit_message: Declare alpha stable
35+
branch: dev
36+
- name: Push dev -> master
37+
uses: ad-m/github-push-action@master
38+
with:
39+
github_token: ${{ secrets.GITHUB_TOKEN }}
40+
branch: master
41+
force: true
42+
- name: version
43+
run: echo "::set-output name=version::$(python setup.py --version)"
44+
id: version
45+
- name: Create Release
46+
id: create_release
47+
uses: actions/create-release@v1
48+
env:
49+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
50+
with:
51+
tag_name: V${{ steps.version.outputs.version }}
52+
release_name: Release ${{ steps.version.outputs.version }}
53+
body: |
54+
Changes in this Release
55+
${{ steps.changelog.outputs.changelog }}
56+
draft: false
57+
prerelease: false
58+
- name: Build Distribution Packages
59+
run: |
60+
python setup.py bdist_wheel
61+
- name: Prepare next Build version
62+
run: echo "::set-output name=version::$(python setup.py --version)"
63+
id: alpha
64+
- name: Increment Version ${{ steps.alpha.outputs.version }}Alpha0
65+
run: |
66+
VER=$(python setup.py --version)
67+
python scripts/bump_build.py
68+
- name: Commit to dev
69+
uses: stefanzweifel/git-auto-commit-action@v4
70+
with:
71+
commit_message: Prepare Next Version
72+
branch: dev
73+
- name: Publish to Test PyPI
74+
uses: pypa/gh-action-pypi-publish@master
75+
with:
76+
password: ${{secrets.PYPI_TOKEN}}

.github/workflows/publish_major.yml

+76
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# This workflow will generate a distribution and upload it to PyPI
2+
3+
name: Publish Major Release X.0.0
4+
on:
5+
workflow_dispatch:
6+
7+
jobs:
8+
build_and_publish:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v2
12+
with:
13+
ref: dev
14+
fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository.
15+
- name: Setup Python
16+
uses: actions/setup-python@v1
17+
with:
18+
python-version: 3.8
19+
- name: Install Build Tools
20+
run: |
21+
python -m pip install build wheel
22+
- name: Remove alpha (declare stable)
23+
run: |
24+
VER=$(python setup.py --version)
25+
python scripts/remove_alpha.py
26+
- name: "Generate release changelog"
27+
uses: heinrichreimer/[email protected]
28+
with:
29+
token: ${{ secrets.GITHUB_TOKEN }}
30+
id: changelog
31+
- name: Commit to dev
32+
uses: stefanzweifel/git-auto-commit-action@v4
33+
with:
34+
commit_message: Declare alpha stable
35+
branch: dev
36+
- name: Push dev -> master
37+
uses: ad-m/github-push-action@master
38+
with:
39+
github_token: ${{ secrets.GITHUB_TOKEN }}
40+
branch: master
41+
force: true
42+
- name: version
43+
run: echo "::set-output name=version::$(python setup.py --version)"
44+
id: version
45+
- name: Create Release
46+
id: create_release
47+
uses: actions/create-release@v1
48+
env:
49+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
50+
with:
51+
tag_name: V${{ steps.version.outputs.version }}
52+
release_name: Release ${{ steps.version.outputs.version }}
53+
body: |
54+
Changes in this Release
55+
${{ steps.changelog.outputs.changelog }}
56+
draft: false
57+
prerelease: false
58+
- name: Build Distribution Packages
59+
run: |
60+
python setup.py bdist_wheel
61+
- name: Prepare next Major version
62+
run: echo "::set-output name=version::$(python setup.py --version)"
63+
id: alpha
64+
- name: Increment Version ${{ steps.alpha.outputs.version }}Alpha0
65+
run: |
66+
VER=$(python setup.py --version)
67+
python scripts/bump_major.py
68+
- name: Commit to dev
69+
uses: stefanzweifel/git-auto-commit-action@v4
70+
with:
71+
commit_message: Prepare Next Version
72+
branch: dev
73+
- name: Publish to Test PyPI
74+
uses: pypa/gh-action-pypi-publish@master
75+
with:
76+
password: ${{secrets.PYPI_TOKEN}}

.github/workflows/publish_minor.yml

+76
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# This workflow will generate a distribution and upload it to PyPI
2+
3+
name: Publish Minor Release .X.0
4+
on:
5+
workflow_dispatch:
6+
7+
jobs:
8+
build_and_publish:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v2
12+
with:
13+
ref: dev
14+
fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository.
15+
- name: Setup Python
16+
uses: actions/setup-python@v1
17+
with:
18+
python-version: 3.8
19+
- name: Install Build Tools
20+
run: |
21+
python -m pip install build wheel
22+
- name: Remove alpha (declare stable)
23+
run: |
24+
VER=$(python setup.py --version)
25+
python scripts/remove_alpha.py
26+
- name: "Generate release changelog"
27+
uses: heinrichreimer/[email protected]
28+
with:
29+
token: ${{ secrets.GITHUB_TOKEN }}
30+
id: changelog
31+
- name: Commit to dev
32+
uses: stefanzweifel/git-auto-commit-action@v4
33+
with:
34+
commit_message: Declare alpha stable
35+
branch: dev
36+
- name: Push dev -> master
37+
uses: ad-m/github-push-action@master
38+
with:
39+
github_token: ${{ secrets.GITHUB_TOKEN }}
40+
branch: master
41+
force: true
42+
- name: version
43+
run: echo "::set-output name=version::$(python setup.py --version)"
44+
id: version
45+
- name: Create Release
46+
id: create_release
47+
uses: actions/create-release@v1
48+
env:
49+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
50+
with:
51+
tag_name: V${{ steps.version.outputs.version }}
52+
release_name: Release ${{ steps.version.outputs.version }}
53+
body: |
54+
Changes in this Release
55+
${{ steps.changelog.outputs.changelog }}
56+
draft: false
57+
prerelease: false
58+
- name: Build Distribution Packages
59+
run: |
60+
python setup.py bdist_wheel
61+
- name: Prepare next Minor version
62+
run: echo "::set-output name=version::$(python setup.py --version)"
63+
id: alpha
64+
- name: Increment Version ${{ steps.alpha.outputs.version }}Alpha0
65+
run: |
66+
VER=$(python setup.py --version)
67+
python scripts/bump_minor.py
68+
- name: Commit to dev
69+
uses: stefanzweifel/git-auto-commit-action@v4
70+
with:
71+
commit_message: Prepare Next Version
72+
branch: dev
73+
- name: Publish to Test PyPI
74+
uses: pypa/gh-action-pypi-publish@master
75+
with:
76+
password: ${{secrets.PYPI_TOKEN}}

hivemind_webchat/version.py

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# The following lines are replaced during the release process.
2+
# START_VERSION_BLOCK
3+
VERSION_MAJOR = 0
4+
VERSION_MINOR = 3
5+
VERSION_BUILD = 1
6+
VERSION_ALPHA = 1
7+
# END_VERSION_BLOCK

scripts/bump_alpha.py

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import fileinput
2+
from os.path import join, dirname
3+
4+
5+
version_file = join(dirname(dirname(__file__)), "hivemind_webchat", "version.py")
6+
version_var_name = "VERSION_ALPHA"
7+
8+
with open(version_file, "r", encoding="utf-8") as v:
9+
for line in v.readlines():
10+
if line.startswith(version_var_name):
11+
version = int(line.split("=")[-1])
12+
new_version = int(version) + 1
13+
14+
for line in fileinput.input(version_file, inplace=True):
15+
if line.startswith(version_var_name):
16+
print(f"{version_var_name} = {new_version}")
17+
else:
18+
print(line.rstrip('\n'))

scripts/bump_build.py

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import fileinput
2+
from os.path import join, dirname
3+
4+
5+
version_file = join(dirname(dirname(__file__)), "hivemind_webchat", "version.py")
6+
version_var_name = "VERSION_BUILD"
7+
alpha_var_name = "VERSION_ALPHA"
8+
9+
with open(version_file, "r", encoding="utf-8") as v:
10+
for line in v.readlines():
11+
if line.startswith(version_var_name):
12+
version = int(line.split("=")[-1])
13+
new_version = int(version) + 1
14+
15+
for line in fileinput.input(version_file, inplace=True):
16+
if line.startswith(version_var_name):
17+
print(f"{version_var_name} = {new_version}")
18+
elif line.startswith(alpha_var_name):
19+
print(f"{alpha_var_name} = 0")
20+
else:
21+
print(line.rstrip('\n'))

0 commit comments

Comments
 (0)