🤫 Sync whisper.cpp #26
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Sync Whisper Repository Combined | |
on: | |
workflow_dispatch: # Allows manual trigger for both jobs | |
schedule: | |
- cron: '0 0 * * *' # Scheduled trigger for both jobs | |
permissions: | |
contents: write | |
jobs: | |
sync-by-tag: | |
name: Sync Repository by Latest Tag | |
runs-on: ubuntu-latest | |
if: (github.event_name == 'workflow_dispatch' || github.event_name == 'schedule') | |
steps: | |
- name: Checkout repository | |
run: | | |
git clone https://x-access-token:${PAT}@github.com/ErcinDedeoglu/stt.git . | |
env: | |
PAT: ${{ secrets.PAT }} | |
- name: Get latest tag name from the external repository | |
id: latest-tag | |
run: | | |
LATEST_TAG=$(git ls-remote --tags --sort="v:refname" https://github.com/ggerganov/whisper.cpp.git | tail -n1 | sed 's/.*refs\/tags\///; s/\^{}//') | |
echo "tag=$LATEST_TAG" >> $GITHUB_ENV | |
- name: Create new branch from the latest tag | |
run: | | |
NEW_BRANCH=$tag | |
git checkout -b $NEW_BRANCH || git checkout $NEW_BRANCH | |
- name: Sync whisper.cpp repository | |
run: | | |
# The target directory is 'src/whisper' | |
mkdir -p src | |
rm -rf src/whisper # Remove the directory if it exists | |
git clone --branch $tag --depth 1 https://github.com/ggerganov/whisper.cpp.git src/whisper | |
# Remove the .git directory and other unwanted files | |
rm -rf src/whisper/.git | |
rm -rf src/whisper/.devops | |
rm -rf src/whisper/.github | |
rm -rf src/whisper/docs | |
rm -rf src/whisper/tests | |
rm -rf src/whisper/samples | |
rm -f src/whisper/LICENSE | |
rm -f src/whisper/.gitignore | |
rm -f src/whisper/.gitmodules | |
find src/whisper -name "*.md" -exec rm {} \; | |
find src/whisper -name "*.txt" -exec rm {} \; | |
- name: Commit and push changes | |
run: | | |
git config --local user.name 'github-actions[bot]' | |
git config --local user.email 'github-actions[bot]@users.noreply.github.com' | |
git show-ref --verify --quiet refs/heads/$tag && git checkout $tag || git checkout -b $tag | |
git stash | |
git pull --rebase origin $tag || true | |
git stash pop || true | |
git add src/whisper | |
git commit -m "Sync whisper.cpp to $tag" || echo "No changes to commit" | |
git push origin $tag | |
env: | |
PAT: ${{ secrets.PAT }} | |
sync-latest-commit: | |
name: Sync Repository with Latest Commit | |
runs-on: ubuntu-latest | |
if: (github.event_name == 'workflow_dispatch' || github.event_name == 'schedule') | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
with: | |
ref: 'main' | |
- name: Sync whisper.cpp repository | |
run: | | |
# The target directory is 'src/whisper' | |
mkdir -p src | |
rm -rf src/whisper # Remove the directory if it exists | |
git clone https://github.com/ggerganov/whisper.cpp.git src/whisper | |
# Remove the .git directory and other unwanted files | |
rm -rf src/whisper/.git | |
rm -rf src/whisper/.devops | |
rm -rf src/whisper/.github | |
rm -rf src/whisper/docs | |
rm -rf src/whisper/tests | |
rm -rf src/whisper/samples | |
rm -f src/whisper/LICENSE | |
rm -f src/whisper/.gitignore | |
rm -f src/whisper/.gitmodules | |
find src/whisper -name "*.md" -exec rm {} \; | |
find src/whisper -name "*.txt" -exec rm {} \; | |
- name: Commit and push changes | |
run: | | |
git config --local user.name 'github-actions[bot]' | |
git config --local user.email 'github-actions[bot]@users.noreply.github.com' | |
git add src/whisper | |
git commit -m "Sync with ggerganov/whisper.cpp" -a || echo "No changes to commit" | |
git push origin 'main' | |
env: | |
GITHUB_TOKEN: ${{ secrets.PAT }} |