Upload Skills to Google Drive #11
This file contains hidden or 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: Upload Skills to Google Drive | |
| on: | |
| push: | |
| branches: | |
| - main # 當有程式碼推送到 main 分支時觸發 | |
| paths: | |
| - 'custom/**' | |
| - 'external/**' # 只有當這兩個資料夾有變動時才觸發 | |
| workflow_dispatch: | |
| inputs: | |
| remote_root_folder: | |
| description: '在 Google Drive 中的目標子資料夾名稱 (Remote Root Folder)' | |
| required: true | |
| default: 'yao-ai-skills' | |
| env: | |
| # 預設的子資料夾名稱 (Push 觸發時使用) | |
| DEFAULT_REMOTE_FOLDER: 'yao-ai-skills' | |
| jobs: | |
| upload: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Prepare Upload Directory | |
| run: | | |
| # 決定最終的資料夾名稱 (手動觸發優先,否則用預設值) | |
| TARGET_FOLDER="${{ github.event.inputs.remote_root_folder || env.DEFAULT_REMOTE_FOLDER }}" | |
| echo "Target folder: $TARGET_FOLDER" | |
| # 建立目標子目錄結構 (直接在根目錄下建立 TARGET_FOLDER) | |
| mkdir -p "$TARGET_FOLDER" | |
| # 將 custom 與 external 複製進去 | |
| cp -r custom "$TARGET_FOLDER/" | |
| cp -r external "$TARGET_FOLDER/" | |
| - name: Upload to Google Drive | |
| uses: adityak74/google-drive-upload-git-action@main | |
| with: | |
| credentials: ${{ secrets.GDRIVE_CREDENTIALS }} | |
| # 上傳目標子資料夾 | |
| filename: "${{ github.event.inputs.remote_root_folder || env.DEFAULT_REMOTE_FOLDER }}/**" | |
| folderId: ${{ secrets.GDRIVE_FOLDER_ID }} | |
| overwrite: "true" | |
| mirrorDirectoryStructure: "true" |