Mirror Sync #171
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: Mirror Sync | |
| on: | |
| # Run daily to catch new upstream versions | |
| schedule: | |
| - cron: '0 4 * * *' # Every day at 4 AM UTC | |
| # Manual trigger | |
| workflow_dispatch: | |
| inputs: | |
| runtime: | |
| description: 'Runtime to sync (node, python, ruby, or all)' | |
| required: true | |
| default: 'all' | |
| type: choice | |
| options: | |
| - all | |
| - node | |
| - python | |
| - ruby | |
| jobs: | |
| sync: | |
| name: Sync ${{ matrix.runtime }} | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 180 # 3 hours max for sync | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| runtime: ${{ (github.event_name == 'workflow_dispatch' && inputs.runtime != 'all') && fromJson(format('["{0}"]', inputs.runtime)) || fromJson('["node", "python", "ruby"]') }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: 'go.mod' | |
| - name: Build mirror tool | |
| run: | | |
| cd scripts/mirror-binaries | |
| go build -o mirror-binaries . | |
| - name: Sync new binaries to R2 | |
| env: | |
| R2_ENDPOINT: https://${{ secrets.CLOUDFLARE_ACCOUNT_ID }}.r2.cloudflarestorage.com | |
| R2_BUCKET: ${{ secrets.CLOUDFLARE_R2_BUILDS_BUCKET }} | |
| R2_ACCESS_KEY: ${{ secrets.CLOUDFLARE_R2_ACCESS_KEY_ID }} | |
| R2_SECRET_KEY: ${{ secrets.CLOUDFLARE_R2_SECRET_ACCESS_KEY }} | |
| run: | | |
| ./scripts/mirror-binaries/mirror-binaries \ | |
| --runtime=${{ matrix.runtime }} \ | |
| --r2-endpoint="$R2_ENDPOINT" \ | |
| --r2-bucket="$R2_BUCKET" \ | |
| --r2-access-key="$R2_ACCESS_KEY" \ | |
| --r2-secret-key="$R2_SECRET_KEY" \ | |
| --sync-only \ | |
| --workers=10 | |
| - name: Generate summary | |
| if: always() | |
| run: | | |
| echo "## Sync Results for ${{ matrix.runtime }}" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "Synced new binaries from upstream that were not already in R2." >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "To generate updated manifests, run the 'Generate Manifests from R2' workflow." >> $GITHUB_STEP_SUMMARY |