Skip to content

🤫 Sync whisper.cpp #31

🤫 Sync whisper.cpp

🤫 Sync whisper.cpp #31

Workflow file for this run

name: 🤫 Sync whisper.cpp
on:
workflow_dispatch:
schedule:
- cron: '0 0 * * *'
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:${{ secrets.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, push changes, and create tag
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 clean -df
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 }}