From 06d6bd055e966ee32d1861d21bebed8c87b5a515 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 9 Nov 2023 11:52:33 +0400 Subject: [PATCH] . --- .github/workflows/sync-whisper.yml | 79 ++++++++++++++++++++++-------- 1 file changed, 59 insertions(+), 20 deletions(-) diff --git a/.github/workflows/sync-whisper.yml b/.github/workflows/sync-whisper.yml index eddecc3..d5656a3 100644 --- a/.github/workflows/sync-whisper.yml +++ b/.github/workflows/sync-whisper.yml @@ -14,50 +14,89 @@ jobs: runs-on: ubuntu-latest if: (github.event_name == 'workflow_dispatch' || github.event_name == 'schedule') steps: - - name: 🛒 Checkout main repository using native git - run: git clone https://x-access-token:${{ secrets.PAT }}@github.com/${{ github.repository }} . - env: - PAT: ${{ secrets.PAT }} - - name: 🏷️ Get latest tag name from the external repository 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 "LATEST_TAG=$LATEST_TAG" >> $GITHUB_ENV + env: + LATEST_TAG: ${{ env.LATEST_TAG }} + + - name: 🛒 Checkout main repository for /TARGET_REPOSITORY + run: git clone https://x-access-token:${{ secrets.PAT }}@github.com/${{ github.repository }} /TARGET_REPOSITORY + env: + PAT: ${{ secrets.PAT }} - - name: 🔀 Create a new branch for the latest tag or checkout if it exists + - name: 🔀 Create/Checout the branch by TAG run: | + cd /TARGET_REPOSITORY git checkout -b $LATEST_TAG || git checkout $LATEST_TAG env: LATEST_TAG: ${{ env.LATEST_TAG }} - - name: 🔄 Sync whisper.cpp repository + - name: Remove everything except for the .git folder in /TARGET_REPOSITORY run: | - # Assuming the current directory is the root of the repository - # Remove everything except for the .git folder + cd /TARGET_REPOSITORY shopt -s extglob rm -rf !(.|..|.git) - # Clone the specific tag of whisper.cpp repository into a temporary directory - git clone --branch $LATEST_TAG --depth 1 https://github.com/ggerganov/whisper.cpp.git temp_dir - - # Copy everything from temp_dir excluding the .git folder + - name: 🛒 Checkout main repository for /MAIN_REPOSITORY + run: git clone https://x-access-token:${{ secrets.PAT }}@github.com/${{ github.repository }} /MAIN_REPOSITORY + env: + PAT: ${{ secrets.PAT }} + + - name: Remove whisper, .git folders in /MAIN_REPOSITORY + run: | + cd /MAIN_REPOSITORY + shopt -s extglob + rm -rf .git + rm -rf src/whisper + + - name: Move content of /MAIN_REPOSITORY to /TARGET_REPOSITORY + run: | + cd /MAIN_REPOSITORY shopt -s dotglob - mv temp_dir/* . - - # Clean up the temporary directory - rm -rf temp_dir + mv -f * /TARGET_REPOSITORY + + - name: 🔄 Clone whisper.cpp by tag + run: | + git clone --branch $LATEST_TAG --depth 1 https://github.com/ggerganov/whisper.cpp.git /LATEST_TAG_WHISPER_CPP + env: + LATEST_TAG: ${{ env.LATEST_TAG }} + + - name: Remove unnecessary files/folders in /LATEST_TAG_WHISPER_CPP folder + run: | + cd /LATEST_TAG + shopt -s extglob + rm -rf .git + rm -rf .devops + rm -rf .github + rm -rf docs + rm -rf tests + rm -rf samples + rm -f LICENSE + rm -f .gitignore + rm -f .gitmodules + find . -name "*.md" -exec rm {} \; + find . -name "*.txt" -exec rm {} \; + + - name: Move content of /LATEST_TAG_WHISPER_CPP to /TARGET_REPOSITORY/src/whisper + run: | + cd /LATEST_TAG_WHISPER_CPP + shopt -s dotglob + mkdir -p /TARGET_REPOSITORY/src/whisper + mv -f * /TARGET_REPOSITORY/src/whisper - name: 💾 Commit and push changes run: | - git config --local user.email "action@github.com" + cd /TARGET_REPOSITORY + git config --local user.email "github-actions[bot]@users.noreply.github.com" git config --local user.name "GitHub Action" git add . git commit -m "Sync with whisper.cpp $LATEST_TAG" git push --set-upstream origin $LATEST_TAG env: LATEST_TAG: ${{ env.LATEST_TAG }} - PAT: ${{ secrets.PAT }} - + sync-latest-commit: name: 🔄 Sync Repository with Latest Commit runs-on: ubuntu-latest