Skip to content

Commit 1a1ff57

Browse files
authored
Add release workflow (#14)
* Added a github workflow * Changed default key to `f10`
1 parent d3e4f3e commit 1a1ff57

File tree

3 files changed

+155
-4
lines changed

3 files changed

+155
-4
lines changed

.github/workflows/artifact.yml

+151
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
name: Build Executable Releases
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
7+
jobs:
8+
build-linux:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Checkout repo
13+
uses: actions/checkout@v2
14+
15+
- name: Set up Python
16+
uses: actions/setup-python@v2
17+
with:
18+
python-version: 3.11
19+
20+
- name: Install dependencies
21+
run: |
22+
sudo apt-get install -y portaudio19-dev gcc
23+
python -m pip install --upgrade pip
24+
pip install .
25+
pip install pyinstaller toml
26+
27+
- name: Build Executable
28+
run: |
29+
pyinstaller --onefile src/openjanus/__main__.py
30+
31+
- name: Get version
32+
id: get_version
33+
run: |
34+
echo "::set-output name=version::$(python -c 'import toml; print(toml.load("pyproject.toml")["project"]["version"])')"
35+
36+
- name: Upload Executable
37+
uses: actions/upload-artifact@v2
38+
with:
39+
name: OpenJanus-linux-${{ steps.get_version.outputs.version }}
40+
path: dist/__main__
41+
42+
build-windows:
43+
runs-on: windows-latest
44+
45+
steps:
46+
- name: Checkout repo
47+
uses: actions/checkout@v2
48+
49+
- name: Set up Python
50+
uses: actions/setup-python@v2
51+
with:
52+
python-version: 3.11
53+
54+
- name: Install dependencies
55+
run: |
56+
python -m pip install --upgrade pip
57+
pip install .
58+
pip install pyinstaller
59+
60+
- name: Build Executable
61+
run: |
62+
pyinstaller --onefile src/openjanus/__main__.py
63+
64+
- name: Get version
65+
id: get_version
66+
run: |
67+
echo "::set-output name=version::$(python -c "import toml; print(toml.load('pyproject.toml')['project']['version'])")"
68+
69+
- name: Upload Executable
70+
uses: actions/upload-artifact@v2
71+
with:
72+
name: OpenJanus-win-${{ steps.get_version.outputs.version }}.exe
73+
path: dist/__main__.exe
74+
75+
release:
76+
needs:
77+
- build-linux
78+
- build-windows
79+
runs-on: ubuntu-latest
80+
81+
steps:
82+
- name: Checkout repo
83+
uses: actions/checkout@v2
84+
85+
- name: Install toml
86+
run: pip install toml
87+
88+
- name: Get version
89+
id: get_version
90+
run: |
91+
echo "::set-output name=version::$(python -c 'import toml; print(toml.load("pyproject.toml")["project"]["version"])')"
92+
93+
- name: Create Release
94+
id: create_release
95+
uses: actions/create-release@v1
96+
env:
97+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
98+
with:
99+
tag_name: ${{ steps.get_version.outputs.version }}
100+
release_name: Release ${{ steps.get_version.outputs.version }}
101+
draft: false
102+
prerelease: false
103+
104+
- name: Download Artifact
105+
uses: actions/download-artifact@v2
106+
107+
- name: Upload Release Asset
108+
uses: actions/upload-release-asset@v1
109+
env:
110+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
111+
with:
112+
upload_url: ${{ steps.create_release.outputs.upload_url }}
113+
asset_path: /home/runner/work/OpenJanus/OpenJanus/OpenJanus-linux-${{ steps.get_version.outputs.version }}/__main__
114+
asset_name: OpenJanus-linux-${{ steps.get_version.outputs.version }}
115+
asset_content_type: application/octet-stream
116+
117+
- name: Upload Release Asset
118+
uses: actions/upload-release-asset@v1
119+
env:
120+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
121+
with:
122+
upload_url: ${{ steps.create_release.outputs.upload_url }}
123+
asset_path: /home/runner/work/OpenJanus/OpenJanus/OpenJanus-win-${{ steps.get_version.outputs.version }}.exe/__main__.exe
124+
asset_name: OpenJanus-win-${{ steps.get_version.outputs.version }}.exe
125+
asset_content_type: application/octet-stream
126+
127+
notify-release:
128+
needs: release
129+
runs-on: ubuntu-latest
130+
131+
steps:
132+
- name: Checkout repo
133+
uses: actions/checkout@v2
134+
135+
- name: Install toml
136+
run: pip install toml
137+
138+
- name: Get version
139+
id: get_version
140+
run: |
141+
echo "::set-output name=version::$(python -c "import toml; print(toml.load('pyproject.toml')['project']['version'])")"
142+
143+
- name: Call Webhook
144+
run: |
145+
curl -X POST \
146+
-H 'Content-Type: application/json' \
147+
-d '{
148+
"text": "[OpenJanus Release ${{ steps.get_version.outputs.version }}](https://github.com/Und3rf10w/OpenJanus/releases/tag/${{ steps.get_version.outputs.version }})\n",
149+
"format": "markdown", "displayName": "Github Actions - OpenJanus"
150+
}' \
151+
${{ secrets.WEBHOOK_URL }}

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ First, set your `OPENAI_API_KEY` and `ELEVEN_API_KEY` in your environment. Next,
2626

2727
First, copy `config.example.toml` to `config.toml`.
2828

29-
First, set the `listen_key` in `config.toml`. For a `fx` key, e.g. `f12`, you can set it to `"fx"` (e.g. `"f12"`). For other keys, you can set it to the key. You must wrap this in double quotation marks (`"`). Multi key input is not currently supported.
29+
First, set the `listen_key` in `config.toml`. For a `fx` key, e.g. `f10`, you can set it to `"fx"` (e.g. `"f10"`). For other keys, you can set it to the key. You must wrap this in double quotation marks (`"`). Multi key input is not currently supported.
3030

3131
Set the `tts_engine` in `config.toml`. This must be either `whisper`, or `elevenlabs`.
3232

@@ -36,7 +36,7 @@ Next, set your API key for whatever service(s) you're using in `config.toml`. Th
3636
> If you have `x_API_KEY` set in your environment, we will default to that first, else, we will pull from the config. E.g. if `OPENAI_API_KEY` is set in your environment, OpenJanus will try that value, and ignore the one in `config.toml`. OpenJanus will forcibly set the environment variable.
3737
3838
# Why?
39-
I see [videos like this](https://www.youtube.com/watch?v=hHy7OZQX_nQ) and they weren't released as open source at the time. In addition, I prefer more agentic architectures when it comes to AI tooling, and having it backed by [LangChain](https://www.langchain.com/) seemed like a reasonable approach
39+
I prefer agentic architectures when it comes to AI tooling, and having a solution for this backed by [LangChain](https://www.langchain.com/) seemed like a reasonable approach
4040

4141
# What/where is the license?
4242
At this time I am not providing a license, but am providing the codebase. Depending on how things go, I'll decide to provide a license.

config.example.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[openjanus]
2-
# Set the listen key. You can use something like `f12` for the `f` keys, or just set a string to a key you want to press.
3-
listen_key = "f12"
2+
# Set the listen key. You can use something like `f10` for the `f` keys, or just set a string to a key you want to press.
3+
listen_key = "f10"
44
# The TTS engine to use, must be one of `whisper` or `elevenlabs`
55
tts_engine = "elevenlabs"
66

0 commit comments

Comments
 (0)