priteshmistry commited on
Commit
93e3906
·
verified ·
1 Parent(s): a0fe6a8

Upload 9 files

Browse files
.github/FUNDING.yml ADDED
@@ -0,0 +1 @@
 
 
1
+ ko_fi: athomasson2
.github/ISSUE_TEMPLATE/bug_report.md ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: Bug report
3
+ about: Info requested for each issue
4
+ title: 'Issue Report'
5
+ labels: 'Issue Report'
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+ **This is just a rudimentary guide, don't be too intimidated, You don't have to follow this to the tee**
11
+ **BEFORE TO OPEN AN ISSUE, MAKE SURE THAT IT HASN'T ALREADY BEEN SOLVED OR REPORTED. :)**
12
+ **Check it with the issue search field**
13
+
14
+ **Script Mode**
15
+ - Native, Docker, Unraid
16
+
17
+ **Script Version**
18
+ - in VERSION.txt or on the terminal when the script starts
19
+
20
+ **Process Mode**
21
+ - Gradio, Headless
22
+
23
+ **Operating System:**
24
+ - Windows, Linux, MacOS
25
+
26
+ **Command Line used to start ebook2audiobook**
27
+ - provide the exact command line
28
+
29
+ **Describe the bug**
30
+ A clear and concise description of what the bug is.
31
+
32
+ **Terminal log**
33
+ Provide the full terminal log from the command line
.github/ISSUE_TEMPLATE/feature_request.md ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: Feature request
3
+ about: New Feature
4
+ title: 'Request a feature'
5
+ labels: 'Feature Request'
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+ **BEFORE TO OPEN A NEW FEATURE REQUEST, MAKE SURE IT HASN'T ALREADY BEEN CREATED. :)**
11
+ **Check it with the issue search field or in Discussions thumbnail**
12
+
13
+ **Describe the feature**
14
+ A clear and concise description of what you need.
15
+
16
+ **Screenshot schema or code**
17
+ Provide a maximum of elements to help us to understand and create this new feature
.github/workflows/Docker-Build.yml ADDED
@@ -0,0 +1,191 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Docker Build
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ inputs:
6
+ wipeAndReinstall:
7
+ type: boolean
8
+ description: 'Wipe & Re-Install E2A'
9
+
10
+ workflow_run:
11
+ workflows: ["Mac E2A Test"]
12
+ types:
13
+ - completed
14
+ branches:
15
+ - main
16
+
17
+ jobs:
18
+ DockerBuild:
19
+ runs-on: [self-hosted, macos]
20
+ steps:
21
+
22
+ - name: Wipe & Re-Clone E2A E2ADockerBuild
23
+ if: ${{ inputs.wipeAndReinstall }}
24
+ run: rm -rf ~/E2ADockerBuild/ebook2audiobook
25
+
26
+ - name: Clone ebook2audiobook
27
+ shell: bash
28
+ run: |
29
+ set -e
30
+
31
+ REPO_DIR=~/E2ADockerBuild/ebook2audiobook
32
+ REPO_URL="https://github.com/${{ github.repository }}"
33
+ IS_PR="${{ github.event_name == 'pull_request' }}"
34
+ BASE_REF="${{ github.event.pull_request.base.ref }}"
35
+ HEAD_REF="${{ github.event.pull_request.head.ref }}"
36
+ HEAD_SHA="${{ github.event.pull_request.head.sha }}"
37
+ TRIGGER_SHA="${{ github.sha }}"
38
+ FRESH_CLONE=0
39
+
40
+ echo "==> Event: ${{ github.event_name }}"
41
+ echo "==> Repo: $REPO_URL"
42
+
43
+ # Clone or reuse
44
+ if [ -d "$REPO_DIR" ]; then
45
+ echo "==> Reusing existing repo"
46
+ cd "$REPO_DIR"
47
+ # Set correct remote and fix ambiguous refs
48
+ git remote set-url origin "$REPO_URL"
49
+ git remote set-head origin -a
50
+ git remote prune origin
51
+ git fetch --all --prune
52
+
53
+ echo "==> Cleaning working directory"
54
+ git reset --hard
55
+ else
56
+ echo "==> Cloning fresh"
57
+ git clone "$REPO_URL" "$REPO_DIR"
58
+ cd "$REPO_DIR"
59
+ git remote set-head origin -a
60
+ git remote prune origin
61
+ git fetch --all --prune
62
+ FRESH_CLONE=1
63
+ fi
64
+
65
+ if [ "$IS_PR" = "true" ]; then
66
+ echo "==> PR detected: simulating GitHub merge (base: $BASE_REF ← head: $HEAD_REF)"
67
+
68
+ # Fetch both branches
69
+ git fetch origin "$BASE_REF":"origin/$BASE_REF"
70
+ git fetch origin "$HEAD_REF":"origin/$HEAD_REF"
71
+
72
+ # Reset to base branch
73
+ git checkout -B "$BASE_REF" "remotes/origin/$BASE_REF"
74
+ git reset --hard "origin/$BASE_REF"
75
+
76
+ # Merge PR source
77
+ if ! git merge --no-ff --no-edit "origin/$HEAD_REF"; then
78
+ echo "❌ Merge conflict simulating PR merge"
79
+ exit 1
80
+ fi
81
+ else
82
+ echo "==> Not a PR: checking out triggered commit directly"
83
+ git fetch origin "$TRIGGER_SHA"
84
+ git checkout --detach "$TRIGGER_SHA"
85
+ git reset --hard "$TRIGGER_SHA"
86
+ fi
87
+
88
+ echo "==> Final repo state:"
89
+ git status
90
+ git log -1 --oneline
91
+
92
+ if [ "$FRESH_CLONE" -eq 1 ]; then
93
+ echo "==> Running ./ebook2audiobook.sh --help because this was a fresh clone"
94
+ if ! ./ebook2audiobook.sh --help; then
95
+ echo "==> Attempting fallback with conda deactivation"
96
+ source "$(conda info --base 2>/dev/null)/etc/profile.d/conda.sh" 2>/dev/null && conda deactivate || true
97
+ ./ebook2audiobook.sh --help
98
+ fi
99
+ else
100
+ echo "==> Skipping script run because repo already existed"
101
+ fi
102
+
103
+ - name: Set up Docker Buildx
104
+ uses: docker/setup-buildx-action@v2
105
+ with:
106
+ driver: docker-container
107
+ buildkitd-flags: "--allow-insecure-entitlement security.insecure --allow-insecure-entitlement network.host"
108
+
109
+ - name: Log in to Docker Hub
110
+ uses: docker/login-action@v2
111
+ with:
112
+ username: ${{ secrets.DOCKER_USERNAME }}
113
+ password: ${{ secrets.DOCKER_PASSWORD }}
114
+
115
+ - name: Get Git Commit Hash
116
+ run: echo "GIT_HASH=${GITHUB_SHA::9}" >> $GITHUB_ENV
117
+
118
+ - name: Get Latest Release Tag
119
+ run: |
120
+ TAG=$(curl -s https://api.github.com/repos/${{ github.repository }}/releases/latest | jq -r .tag_name)
121
+ if [ -z "$TAG" ] || [ "$TAG" == "null" ]; then TAG="latest"; fi
122
+ echo "RELEASE_TAG=$TAG" >> $GITHUB_ENV
123
+
124
+ - name: Debug Print Variables
125
+ run: |
126
+ echo "DOCKER_USERNAME=${{ secrets.DOCKER_USERNAME }}"
127
+ echo "GIT_HASH=${GIT_HASH}"
128
+ echo "RELEASE_TAG=${RELEASE_TAG}"
129
+
130
+ - name: Build and Push Release Docker Image
131
+ run: |
132
+ cd ~/E2ADockerBuild/ebook2audiobook
133
+ docker buildx build --pull --platform linux/amd64,linux/arm64 \
134
+ -t ${{ secrets.DOCKER_USERNAME }}/ebook2audiobook:${GIT_HASH} \
135
+ -t ${{ secrets.DOCKER_USERNAME }}/ebook2audiobook:${RELEASE_TAG} \
136
+ -t ${{ secrets.DOCKER_USERNAME }}/ebook2audiobook:latest \
137
+ --push .
138
+
139
+ - name: Prune docker & buildx
140
+ run: |
141
+ docker system prune -af --volumes
142
+ docker buildx prune -af
143
+
144
+ huggingface-build:
145
+ runs-on: [self-hosted, macos]
146
+ steps:
147
+
148
+ - name: Wipe & Re-Clone E2A E2ADockerBuild
149
+ if: ${{ inputs.wipeAndReinstall }}
150
+ run: rm -rf ~/E2ADockerBuild/ebook2audiobook
151
+
152
+ - name: Clone ebook2audiobook into E2ADockerBuild
153
+ shell: bash
154
+ run: |
155
+ if [ -d ~/E2ADockerBuild/ebook2audiobook ]; then
156
+ cd ~/E2ADockerBuild/ebook2audiobook
157
+ git fetch --all
158
+ git reset --hard ${{ github.event.pull_request.head.sha || github.sha }}
159
+ else
160
+ git clone https://github.com/DrewThomasson/ebook2audiobook.git ~/E2ADockerBuild/ebook2audiobook
161
+ cd ~/E2ADockerBuild/ebook2audiobook
162
+ git fetch --all
163
+ git reset --hard ${{ github.event.pull_request.head.sha || github.sha }}
164
+ fi
165
+
166
+ - name: Set up Docker Buildx
167
+ uses: docker/setup-buildx-action@v2
168
+ with:
169
+ driver: docker-container
170
+ buildkitd-flags: "--allow-insecure-entitlement security.insecure --allow-insecure-entitlement network.host"
171
+
172
+ - name: Log in to Docker Hub
173
+ uses: docker/login-action@v2
174
+ with:
175
+ username: ${{ secrets.DOCKER_USERNAME }}
176
+ password: ${{ secrets.DOCKER_PASSWORD }}
177
+
178
+ - name: Build and Push Huggingface Docker Image
179
+ run: |
180
+ cd ~/E2ADockerBuild/ebook2audiobook
181
+ docker buildx build --platform linux/amd64 \
182
+ -f dockerfiles/HuggingfaceDockerfile \
183
+ -t ${{ secrets.DOCKER_USERNAME }}/ebook2audiobook:HuggingfaceSpace \
184
+ --push .
185
+
186
+ - name: Prune docker & buildx
187
+ run: |
188
+ docker system prune -af --volumes
189
+ docker buildx prune -af
190
+
191
+
.github/workflows/E2A-Test.yml ADDED
@@ -0,0 +1,246 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Mac E2A Test
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ inputs:
6
+ wipeAndReinstall:
7
+ type: boolean
8
+ description: 'Wipe & Re-Install E2A'
9
+
10
+ pull_request:
11
+ branches:
12
+ - main
13
+ types:
14
+ - opened
15
+ - synchronize
16
+ - reopened
17
+ paths-ignore:
18
+ - CODE_OF_CONDUCT.md
19
+ - LICENSE
20
+ - README.md
21
+ - readme/**
22
+ - dockerfiles/**
23
+ - Notebooks/**
24
+ - .github/workflows/stale.yml
25
+ - .github/workflows/custom-command.yml
26
+
27
+ push:
28
+ branches:
29
+ - main
30
+ paths-ignore:
31
+ - CODE_OF_CONDUCT.md
32
+ - LICENSE
33
+ - README.md
34
+ - readme/**
35
+ - dockerfiles/**
36
+ - Notebooks/**
37
+ - .github/workflows/stale.yml
38
+ - .github/workflows/custom-command.yml
39
+
40
+ release:
41
+ types:
42
+ - published
43
+
44
+ jobs:
45
+ macos-E2A:
46
+ runs-on: [self-hosted, macos]
47
+
48
+ steps:
49
+
50
+ - name: Print runner info
51
+ shell: bash
52
+ run: |
53
+ echo "Running on:"
54
+ uname -a
55
+ sw_vers
56
+
57
+ - name: Wipe & Re-Install E2A
58
+ if: ${{ inputs.wipeAndReinstall }}
59
+ shell: bash
60
+ run: rm -rf ~/ebook2audiobook
61
+
62
+ - name: Clone ebook2audiobook
63
+ shell: bash
64
+ run: |
65
+ set -e
66
+
67
+ REPO_DIR=~/ebook2audiobook
68
+ REPO_URL="https://github.com/${{ github.repository }}"
69
+ IS_PR="${{ github.event_name == 'pull_request' }}"
70
+ BASE_REF="${{ github.event.pull_request.base.ref }}"
71
+ HEAD_REF="${{ github.event.pull_request.head.ref }}"
72
+ HEAD_SHA="${{ github.event.pull_request.head.sha }}"
73
+ TRIGGER_SHA="${{ github.sha }}"
74
+ FRESH_CLONE=0
75
+
76
+ echo "==> Event: ${{ github.event_name }}"
77
+ echo "==> Repo: $REPO_URL"
78
+
79
+ # Clone or reuse
80
+ if [ -d "$REPO_DIR" ]; then
81
+ echo "==> Reusing existing repo"
82
+ cd "$REPO_DIR"
83
+ # Set correct remote and fix ambiguous refs
84
+ git remote set-url origin "$REPO_URL"
85
+ git remote set-head origin -a
86
+ git remote prune origin
87
+ git fetch --all --prune
88
+
89
+ echo "==> Cleaning working directory"
90
+ git reset --hard
91
+ else
92
+ echo "==> Cloning fresh"
93
+ git clone "$REPO_URL" "$REPO_DIR"
94
+ cd "$REPO_DIR"
95
+ git remote set-head origin -a
96
+ git remote prune origin
97
+ git fetch --all --prune
98
+ FRESH_CLONE=1
99
+ fi
100
+
101
+ if [ "$IS_PR" = "true" ]; then
102
+ echo "==> PR detected: simulating GitHub merge (base: $BASE_REF ← head: $HEAD_REF)"
103
+
104
+ # Fetch both branches
105
+ git fetch origin "$BASE_REF":"origin/$BASE_REF"
106
+ git fetch origin "$HEAD_REF":"origin/$HEAD_REF"
107
+
108
+ # Reset to base branch
109
+ git checkout -B "$BASE_REF" "remotes/origin/$BASE_REF"
110
+ git reset --hard "origin/$BASE_REF"
111
+
112
+ # Merge PR source
113
+ if ! git merge --no-ff --no-edit "origin/$HEAD_REF"; then
114
+ echo "❌ Merge conflict simulating PR merge"
115
+ echo "❌ Initial merge failed, attempting cleanup of __pycache__ and retry..."
116
+
117
+ # Remove known __pycache__ dirs that may cause conflict
118
+ echo "==> Cleaning up untracked files like __pycache__"
119
+ git clean -ffd lib/
120
+
121
+ # Retry the merge
122
+ if ! git merge --no-ff --no-edit "origin/$HEAD_REF"; then
123
+ echo "❌ Merge still failed after cleanup"
124
+ exit 1
125
+ fi
126
+ fi
127
+ else
128
+ echo "==> Not a PR: checking out triggered commit directly"
129
+ git fetch origin "$TRIGGER_SHA"
130
+ git checkout --detach "$TRIGGER_SHA"
131
+ git reset --hard "$TRIGGER_SHA"
132
+ fi
133
+
134
+ echo "==> Final repo state:"
135
+ git status
136
+ git log -1 --oneline
137
+
138
+ if [ "$FRESH_CLONE" -eq 1 ]; then
139
+ echo "==> Running ./ebook2audiobook.sh --help because this was a fresh clone"
140
+ if ! ./ebook2audiobook.sh --help; then
141
+ echo "==> Attempting fallback with conda deactivation"
142
+ source "$(conda info --base 2>/dev/null)/etc/profile.d/conda.sh" 2>/dev/null && conda deactivate || true
143
+ ./ebook2audiobook.sh --help
144
+ fi
145
+ else
146
+ echo "==> Skipping script run because repo already existed"
147
+ fi
148
+
149
+
150
+ - name: Create Audiobook Output folders for Artifacts
151
+ shell: bash
152
+ run: |
153
+ mkdir -p ~/ebook2audiobook/audiobooks/{TACOTRON2,FAIRSEQ,UnFAIRSEQ,VITS,YOURTTS,XTTSv2,XTTSv2FineTune,BARK}
154
+ find ~/ebook2audiobook/audiobooks/{TACOTRON2,FAIRSEQ,UnFAIRSEQ,VITS,YOURTTS,XTTSv2,XTTSv2FineTune,BARK} -mindepth 1 -exec rm -rf {} +
155
+
156
+ - name: Add set -e at beginning of ebook2audiobook.sh (for error passing)
157
+ shell: bash
158
+ run: |
159
+ echo "Adding set -e at beginning of ebook2audiobook.sh (for error passing)..."
160
+ cd ~/ebook2audiobook
161
+ source "$(conda info --base)/etc/profile.d/conda.sh"
162
+ conda deactivate
163
+ sed -i '' '1s;^;set -e\n;' ebook2audiobook.sh
164
+
165
+ - name: English TACOTRON2 Custom-Voice headless single test
166
+ shell: bash
167
+ run: |
168
+ echo "Running English TACOTRON2 Custom-Voice headless single test..."
169
+ cd ~/ebook2audiobook
170
+ source "$(conda info --base)/etc/profile.d/conda.sh"
171
+ conda deactivate
172
+ ./ebook2audiobook.sh --headless --language eng --ebook "tools/workflow-testing/test1.txt" --tts_engine TACOTRON2 --voice "voices/eng/elder/male/DavidAttenborough.wav" --output_dir ~/ebook2audiobook/audiobooks/TACOTRON2
173
+
174
+
175
+ - name: English FAIRSEQ Custom-Voice headless single test
176
+ shell: bash
177
+ run: |
178
+ echo "Running English FAIRSEQ Custom-Voice headless single test..."
179
+ cd ~/ebook2audiobook
180
+ source "$(conda info --base)/etc/profile.d/conda.sh"
181
+ conda deactivate
182
+ ./ebook2audiobook.sh --headless --language eng --ebook "tools/workflow-testing/test1.txt" --tts_engine FAIRSEQ --voice "voices/eng/elder/male/DavidAttenborough.wav" --output_dir ~/ebook2audiobook/audiobooks/FAIRSEQ
183
+
184
+
185
+ - name: Unusual FAIRSEQ Custom-Voice headless single test
186
+ shell: bash
187
+ run: |
188
+ echo "Running Unusual FAIRSEQ Custom-Voice headless single test..."
189
+ cd ~/ebook2audiobook
190
+ source "$(conda info --base)/etc/profile.d/conda.sh"
191
+ conda deactivate
192
+ ./ebook2audiobook.sh --headless --language urd-script_devanagari --ebook "tools/workflow-testing/urd-script_davanagari-test.txt" --tts_engine FAIRSEQ --voice "voices/eng/elder/male/DavidAttenborough.wav" --output_dir ~/ebook2audiobook/audiobooks/UnFAIRSEQ
193
+
194
+ - name: English VITS Custom-Voice headless single test
195
+ shell: bash
196
+ run: |
197
+ echo "Running English VITS Custom-Voice headless single test..."
198
+
199
+ cd ~/ebook2audiobook
200
+ source "$(conda info --base)/etc/profile.d/conda.sh"
201
+ conda deactivate
202
+ ./ebook2audiobook.sh --headless --language eng --ebook "tools/workflow-testing/test1.txt" --tts_engine VITS --voice "voices/eng/elder/male/DavidAttenborough.wav" --output_dir ~/ebook2audiobook/audiobooks/VITS
203
+
204
+ - name: English YOURTTS Custom-Voice headless batch test
205
+ shell: bash
206
+ run: |
207
+ echo "Running English YOURTTS Custom-Voice headless batch test..."
208
+ cd ~/ebook2audiobook
209
+ source "$(conda info --base)/etc/profile.d/conda.sh"
210
+ conda deactivate
211
+ ./ebook2audiobook.sh --headless --language eng --ebooks_dir "tools/workflow-testing" --tts_engine YOURTTS --voice "voices/eng/elder/male/DavidAttenborough.wav" --output_dir ~/ebook2audiobook/audiobooks/YOURTTS
212
+
213
+
214
+ - name: Default XTTSv2 headless Custom-Voice single test
215
+ shell: bash
216
+ run: |
217
+ echo "Running Default XTTSv2 headless Custom-Voice single test..."
218
+ cd ~/ebook2audiobook
219
+ source "$(conda info --base)/etc/profile.d/conda.sh"
220
+ conda deactivate
221
+ ./ebook2audiobook.sh --headless --language eng --ebook "tools/workflow-testing/test1.txt" --tts_engine XTTSv2 --voice "voices/eng/elder/male/DavidAttenborough.wav" --output_dir ~/ebook2audiobook/audiobooks/XTTSv2
222
+
223
+ - name: English XTTSv2 headless fine-tuned XTTSv2 model single test
224
+ shell: bash
225
+ run: |
226
+ echo "Running English XTTSv2 headless fine-tuned XTTSv2 model single test..."
227
+ cd ~/ebook2audiobook
228
+ source "$(conda info --base)/etc/profile.d/conda.sh"
229
+ conda deactivate
230
+ ./ebook2audiobook.sh --headless --language eng --ebook "tools/workflow-testing/test1.txt" --tts_engine XTTSv2 --fine_tuned AiExplained --output_dir ~/ebook2audiobook/audiobooks/XTTSv2FineTune
231
+
232
+ - name: English BARK Custom-Voice headless single test
233
+ shell: bash
234
+ run: |
235
+ echo "Running English XTTSv2 headless fine-tuned XTTSv2 model single test..."
236
+ cd ~/ebook2audiobook
237
+ source "$(conda info --base)/etc/profile.d/conda.sh"
238
+ conda deactivate
239
+ ./ebook2audiobook.sh --headless --language eng --ebook "tools/workflow-testing/test1.txt" --tts_engine BARK --voice "voices/eng/elder/male/DavidAttenborough.wav" --output_dir ~/ebook2audiobook/audiobooks/BARK
240
+
241
+ - name: Upload audiobooks folder artifact
242
+ if: always()
243
+ uses: actions/upload-artifact@v4
244
+ with:
245
+ name: audiobooks
246
+ path: ~/ebook2audiobook/audiobooks
.github/workflows/custom-command.yml ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Custom Command Runner
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ inputs:
6
+ custom_command:
7
+ description: 'Enter a shell command to run on self-hosted Mac'
8
+ required: true
9
+ default: 'echo Hello from Mac!'
10
+
11
+ jobs:
12
+ CustomCommand:
13
+ runs-on: [self-hosted, macos]
14
+ steps:
15
+ - name: Run Custom Command
16
+ run: |
17
+ eval "${{ github.event.inputs.custom_command }}"
.github/workflows/oldDockerBasedWorkflows.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a415c609ac7b16ed6d59f361aac416775d76336dccbf13670d7de373d510aa22
3
+ size 18217
.github/workflows/stale.yml ADDED
@@ -0,0 +1,122 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: 'Close stale issues and PRs'
2
+ on:
3
+ schedule:
4
+ - cron: '30 1 * * 0' # Runs Once Every Sunday
5
+
6
+ jobs:
7
+ stale:
8
+ runs-on: ubuntu-latest
9
+ permissions:
10
+ issues: write
11
+ pull-requests: write
12
+ steps:
13
+ - name: Close Stale Issues
14
+ uses: actions/[email protected]
15
+ with:
16
+ # Token for the repository. Can be passed in using `{{ secrets.GITHUB_TOKEN }}`.
17
+ #repo-token: # optional, default is ${{ github.token }}
18
+ # The message to post on the issue when tagging it. If none provided, will not mark issues stale.
19
+ stale-issue-message: 'This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If this issue is still relevant, please comment or remove the stale label to keep it open.'
20
+ # The message to post on the pull request when tagging it. If none provided, will not mark pull requests stale.
21
+ stale-pr-message: 'This pull request has been automatically marked as stale due to inactivity. It will be closed if no further activity occurs. Please comment or remove the stale label if you would like to keep it open.'
22
+ # The message to post on the issue when closing it. If none provided, will not comment when closing an issue.
23
+ #close-issue-message: # optional
24
+ # The message to post on the pull request when closing it. If none provided, will not comment when closing a pull requests.
25
+ #close-pr-message: # optional
26
+ # The number of days old an issue or a pull request can be before marking it stale. Set to -1 to never mark issues or pull requests as stale automatically.
27
+ days-before-stale: 10
28
+ # The number of days old an issue can be before marking it stale. Set to -1 to never mark issues as stale automatically. Override "days-before-stale" option regarding only the issues.
29
+ #days-before-issue-stale: # optional
30
+ # The number of days old a pull request can be before marking it stale. Set to -1 to never mark pull requests as stale automatically. Override "days-before-stale" option regarding only the pull requests.
31
+ #days-before-pr-stale: # optional
32
+ # The number of days to wait to close an issue or a pull request after it being marked stale. Set to -1 to never close stale issues or pull requests.
33
+ days-before-close: 10
34
+ # The number of days to wait to close an issue after it being marked stale. Set to -1 to never close stale issues. Override "days-before-close" option regarding only the issues.
35
+ #days-before-issue-close: # optional
36
+ # The number of days to wait to close a pull request after it being marked stale. Set to -1 to never close stale pull requests. Override "days-before-close" option regarding only the pull requests.
37
+ #days-before-pr-close: # optional
38
+ # The label to apply when an issue is stale.
39
+ #stale-issue-label: # optional, default is Stale
40
+ # The label to apply when an issue is closed.
41
+ #close-issue-label: # optional
42
+ # The labels that mean an issue is exempt from being marked stale. Separate multiple labels with commas (eg. "label1,label2").
43
+ #exempt-issue-labels: # optional, default is
44
+ # The reason to use when closing an issue.
45
+ #close-issue-reason: # optional, default is not_planned
46
+ # The label to apply when a pull request is stale.
47
+ #stale-pr-label: # optional, default is Stale
48
+ # The label to apply when a pull request is closed.
49
+ #close-pr-label: # optional
50
+ # The labels that mean a pull request is exempt from being marked as stale. Separate multiple labels with commas (eg. "label1,label2").
51
+ #exempt-pr-labels: # optional, default is
52
+ # The milestones that mean an issue or a pull request is exempt from being marked as stale. Separate multiple milestones with commas (eg. "milestone1,milestone2").
53
+ #exempt-milestones: # optional, default is
54
+ # The milestones that mean an issue is exempt from being marked as stale. Separate multiple milestones with commas (eg. "milestone1,milestone2"). Override "exempt-milestones" option regarding only the issues.
55
+ #exempt-issue-milestones: # optional, default is
56
+ # The milestones that mean a pull request is exempt from being marked as stale. Separate multiple milestones with commas (eg. "milestone1,milestone2"). Override "exempt-milestones" option regarding only the pull requests.
57
+ #exempt-pr-milestones: # optional, default is
58
+ # Exempt all issues and pull requests with milestones from being marked as stale. Default to false.
59
+ #exempt-all-milestones: # optional, default is false
60
+ # Exempt all issues with milestones from being marked as stale. Override "exempt-all-milestones" option regarding only the issues.
61
+ #exempt-all-issue-milestones: # optional, default is
62
+ # Exempt all pull requests with milestones from being marked as stale. Override "exempt-all-milestones" option regarding only the pull requests.
63
+ #exempt-all-pr-milestones: # optional, default is
64
+ # Only issues or pull requests with all of these labels are checked if stale. Defaults to `` (disabled) and can be a comma-separated list of labels.
65
+ #only-labels: # optional, default is
66
+ # Only issues or pull requests with at least one of these labels are checked if stale. Defaults to `` (disabled) and can be a comma-separated list of labels.
67
+ #any-of-labels: # optional, default is
68
+ # Only issues with at least one of these labels are checked if stale. Defaults to `` (disabled) and can be a comma-separated list of labels. Override "any-of-labels" option regarding only the issues.
69
+ #any-of-issue-labels: # optional, default is
70
+ # Only pull requests with at least one of these labels are checked if stale. Defaults to `` (disabled) and can be a comma-separated list of labels. Override "any-of-labels" option regarding only the pull requests.
71
+ #any-of-pr-labels: # optional, default is
72
+ # Only issues with all of these labels are checked if stale. Defaults to `[]` (disabled) and can be a comma-separated list of labels. Override "only-labels" option regarding only the issues.
73
+ #only-issue-labels: # optional, default is
74
+ # Only pull requests with all of these labels are checked if stale. Defaults to `[]` (disabled) and can be a comma-separated list of labels. Override "only-labels" option regarding only the pull requests.
75
+ #only-pr-labels: # optional, default is
76
+ # The maximum number of operations per run, used to control rate limiting (GitHub API CRUD related).
77
+ #operations-per-run: # optional, default is 30
78
+ # Remove stale labels from issues and pull requests when they are updated or commented on.
79
+ #remove-stale-when-updated: # optional, default is true
80
+ # Remove stale labels from issues when they are updated or commented on. Override "remove-stale-when-updated" option regarding only the issues.
81
+ #remove-issue-stale-when-updated: # optional, default is
82
+ # Remove stale labels from pull requests when they are updated or commented on. Override "remove-stale-when-updated" option regarding only the pull requests.
83
+ #remove-pr-stale-when-updated: # optional, default is
84
+ # Run the processor in debug mode without actually performing any operations on live issues.
85
+ #debug-only: # optional, default is false
86
+ # The order to get issues or pull requests. Defaults to false, which is descending.
87
+ #ascending: # optional, default is false
88
+ # Delete the git branch after closing a stale pull request.
89
+ #delete-branch: # optional, default is false
90
+ # The date used to skip the stale action on issue/pull request created before it (ISO 8601 or RFC 2822).
91
+ #start-date: # optional, default is
92
+ # The assignees which exempt an issue or a pull request from being marked as stale. Separate multiple assignees with commas (eg. "user1,user2").
93
+ #exempt-assignees: # optional, default is
94
+ # The assignees which exempt an issue from being marked as stale. Separate multiple assignees with commas (eg. "user1,user2"). Override "exempt-assignees" option regarding only the issues.
95
+ #exempt-issue-assignees: # optional, default is
96
+ # The assignees which exempt a pull request from being marked as stale. Separate multiple assignees with commas (eg. "user1,user2"). Override "exempt-assignees" option regarding only the pull requests.
97
+ #exempt-pr-assignees: # optional, default is
98
+ # Exempt all issues and pull requests with assignees from being marked as stale. Default to false.
99
+ #exempt-all-assignees: # optional, default is false
100
+ # Exempt all issues with assignees from being marked as stale. Override "exempt-all-assignees" option regarding only the issues.
101
+ #exempt-all-issue-assignees: # optional, default is
102
+ # Exempt all pull requests with assignees from being marked as stale. Override "exempt-all-assignees" option regarding only the pull requests.
103
+ #exempt-all-pr-assignees: # optional, default is
104
+ # Exempt draft pull requests from being marked as stale. Default to false.
105
+ #exempt-draft-pr: # optional, default is false
106
+ # Display some statistics at the end regarding the stale workflow (only when the logs are enabled).
107
+ #enable-statistics: # optional, default is true
108
+ # A comma delimited list of labels to add when an issue or pull request becomes unstale.
109
+ #labels-to-add-when-unstale: # optional, default is
110
+ # A comma delimited list of labels to remove when an issue or pull request becomes stale.
111
+ #labels-to-remove-when-stale: # optional, default is
112
+ # A comma delimited list of labels to remove when an issue or pull request becomes unstale.
113
+ #labels-to-remove-when-unstale: # optional, default is
114
+ # Any update (update/comment) can reset the stale idle time on the issues and pull requests.
115
+ #ignore-updates: # optional, default is false
116
+ # Any update (update/comment) can reset the stale idle time on the issues. Override "ignore-updates" option regarding only the issues.
117
+ #ignore-issue-updates: # optional, default is
118
+ # Any update (update/comment) can reset the stale idle time on the pull requests. Override "ignore-updates" option regarding only the pull requests.
119
+ #ignore-pr-updates: # optional, default is
120
+ # Only the issues or the pull requests with an assignee will be marked as stale automatically.
121
+ #include-only-assigned: # optional, default is false
122
+
.github/workflows/update-huggingface-space.yml ADDED
@@ -0,0 +1,118 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Check and Update Hugging Face Space
2
+
3
+ on:
4
+ schedule:
5
+ - cron: '0 0 * * *'
6
+ workflow_dispatch:
7
+ inputs:
8
+ space_id:
9
+ description: 'Hugging Face Space ID (format: username/spacename)'
10
+ required: true
11
+ default: 'drewThomasson/ebook2audiobook'
12
+ type: string
13
+ workflow_run:
14
+ workflows: ["Docker Build"]
15
+ types:
16
+ - completed
17
+
18
+ jobs:
19
+ check-space:
20
+ runs-on: ubuntu-latest
21
+ outputs:
22
+ is_running: ${{ steps.check-status.outputs.is_running }}
23
+ space_status: ${{ steps.check-status.outputs.space_status }}
24
+ steps:
25
+ - name: Check out repository
26
+ uses: actions/checkout@v4
27
+
28
+ - name: Set up Python
29
+ uses: actions/setup-python@v4
30
+ with:
31
+ python-version: '3.10'
32
+
33
+ - name: Install dependencies
34
+ run: |
35
+ python -m pip install --upgrade pip
36
+ pip install requests
37
+
38
+ - name: Check Space Status
39
+ id: check-status
40
+ run: |
41
+ python - <<'EOF'
42
+ import requests
43
+ import os
44
+
45
+ def check_space_status(space_id):
46
+ url = f"https://huggingface.co/api/spaces/{space_id}/runtime"
47
+ response = requests.get(url)
48
+ if response.status_code == 200:
49
+ data = response.json()
50
+ status = data.get("stage", "UNKNOWN")
51
+ print(f"Space status: {status}")
52
+ return status
53
+ else:
54
+ print(f"Error: {response.status_code}")
55
+ return "ERROR"
56
+
57
+ space_id = "${{ github.event.inputs.space_id }}"
58
+ status = check_space_status(space_id)
59
+
60
+ # Set output variables
61
+ is_running = "true" if status == "RUNNING" else "false"
62
+ print(f"::set-output name=is_running::{is_running}")
63
+ print(f"::set-output name=space_status::{status}")
64
+ EOF
65
+
66
+ - name: Report Status
67
+ run: |
68
+ echo "Space: ${{ github.event.inputs.space_id }}"
69
+ echo "Status: ${{ steps.check-status.outputs.space_status }}"
70
+ echo "Is Running: ${{ steps.check-status.outputs.is_running }}"
71
+
72
+ update-huggingface:
73
+ runs-on: ubuntu-latest
74
+ needs: check-space
75
+ if: ${{ needs.check-space.outputs.space_status != 'RUNNING' }}
76
+ steps:
77
+ - name: Checkout self repository for VERSION.txt
78
+ uses: actions/checkout@v4
79
+ with:
80
+ path: source
81
+
82
+ - name: Set up Git
83
+ run: |
84
+ git config --global user.name "GitHub Action"
85
+ git config --global user.email "[email protected]"
86
+
87
+ - name: Install Git LFS
88
+ run: |
89
+ curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | sudo bash
90
+ sudo apt-get install git-lfs
91
+ git lfs install
92
+
93
+ - name: Configure Hugging Face credentials
94
+ run: |
95
+ echo "machine hf-prod.huggingface.co login api password ${{ secrets.HUGGINGFACE_TOKEN }}" > ~/.netrc
96
+ echo "machine huggingface.co login api password ${{ secrets.HUGGINGFACE_TOKEN }}" >> ~/.netrc
97
+
98
+ - name: Clone Hugging Face space repository
99
+ run: |
100
+ git clone https://huggingface.co/spaces/drewThomasson/ebook2audiobook
101
+
102
+ - name: Update README and updates.txt in Hugging Face space
103
+ run: |
104
+ # Read version from the source repository's VERSION.txt
105
+ VERSION=$(cat source/VERSION.txt | tr -d ' \t\n')
106
+ echo "Updating README with version $VERSION"
107
+ cd ebook2audiobook
108
+ # Update updates.txt (append or create if it doesn't exist)
109
+ if [ ! -f updates.txt ]; then
110
+ echo "update" > updates.txt
111
+ else
112
+ echo "update" >> updates.txt
113
+ fi
114
+ # Update the version in the README file using sed
115
+ sed -i "s/^title: Ebook2audiobook v[0-9.]\+/title: Ebook2audiobook v$VERSION/" README.md
116
+ git add updates.txt README.md
117
+ git commit -m "Update version in README to $VERSION and add update entry to updates.txt"
118
+ git push