add scripts #28
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: Sync Colab Scripts to Google Drive | |
| # python/ 디렉토리의 .py 파일이 변경되어 push될 때 자동 실행 | |
| on: | |
| push: | |
| branches: | |
| - transform_to_multi_scale_model | |
| - main | |
| paths: | |
| - 'python/**.py' | |
| jobs: | |
| sync-to-drive: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout Code | |
| uses: actions/checkout@v4 | |
| # rclone 설치 | |
| - name: Install rclone | |
| run: curl https://rclone.org/install.sh | sudo bash | |
| # rclone 설정 (OAuth2 토큰 방식 — 개인 My Drive 쓰기 가능) | |
| # Service Account는 개인 Drive 스토리지 할당량 없어 403 발생 → OAuth2로 교체 | |
| - name: Configure rclone | |
| run: | | |
| mkdir -p ~/.config/rclone | |
| cat > ~/.config/rclone/rclone.conf << EOF | |
| [gdrive] | |
| type = drive | |
| scope = drive | |
| token = ${{ secrets.GDRIVE_RCLONE_TOKEN }} | |
| root_folder_id = ${{ secrets.GDRIVE_FOLDER_ID }} | |
| EOF | |
| # python/*.py 파일을 Drive의 rcp_5th/python/ 으로 동기화 | |
| # --checksum: 내용이 실제로 변경된 파일만 전송 (수정 시간 기준 아님) | |
| - name: Upload Python Scripts to Drive | |
| run: | | |
| rclone copy python/ gdrive: \ | |
| --include "*.py" \ | |
| --checksum \ | |
| --progress \ | |
| --stats 10s | |
| # 변경된 파일 목록 로그 출력 | |
| - name: List Uploaded Files | |
| run: | | |
| echo "=== Drive 업로드 완료 ===" | |
| rclone ls gdrive: --include "*.py" |