|
| 1 | +name: Generate Manifests from R2 |
| 2 | + |
| 3 | +on: |
| 4 | + # Trigger after mirror sync completes |
| 5 | + workflow_run: |
| 6 | + workflows: ["Mirror Sync"] |
| 7 | + types: |
| 8 | + - completed |
| 9 | + # Manual trigger |
| 10 | + workflow_dispatch: |
| 11 | + inputs: |
| 12 | + runtime: |
| 13 | + description: 'Runtime to generate (node, python, ruby, or all)' |
| 14 | + required: true |
| 15 | + default: 'all' |
| 16 | + type: choice |
| 17 | + options: |
| 18 | + - all |
| 19 | + - node |
| 20 | + - python |
| 21 | + - ruby |
| 22 | + dry_run: |
| 23 | + description: 'Dry run (report only, no file changes)' |
| 24 | + required: false |
| 25 | + default: false |
| 26 | + type: boolean |
| 27 | + |
| 28 | +jobs: |
| 29 | + generate: |
| 30 | + name: Generate Manifests |
| 31 | + runs-on: ubuntu-latest |
| 32 | + if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' }} |
| 33 | + |
| 34 | + steps: |
| 35 | + - name: Checkout |
| 36 | + uses: actions/checkout@v4 |
| 37 | + |
| 38 | + - name: Setup Go |
| 39 | + uses: actions/setup-go@v5 |
| 40 | + with: |
| 41 | + go-version-file: 'go.mod' |
| 42 | + |
| 43 | + - name: Build manifest generator |
| 44 | + run: | |
| 45 | + cd scripts/generate-manifests-from-r2 |
| 46 | + go build -o generate-manifests . |
| 47 | +
|
| 48 | + - name: Generate manifests (dry run) |
| 49 | + if: ${{ github.event_name == 'workflow_dispatch' && inputs.dry_run }} |
| 50 | + env: |
| 51 | + R2_ENDPOINT: https://${{ secrets.CLOUDFLARE_ACCOUNT_ID }}.r2.cloudflarestorage.com |
| 52 | + R2_BUCKET: ${{ secrets.CLOUDFLARE_R2_BUILDS_BUCKET }} |
| 53 | + R2_ACCESS_KEY: ${{ secrets.CLOUDFLARE_R2_ACCESS_KEY_ID }} |
| 54 | + R2_SECRET_KEY: ${{ secrets.CLOUDFLARE_R2_SECRET_ACCESS_KEY }} |
| 55 | + run: | |
| 56 | + RUNTIME="${{ inputs.runtime || 'all' }}" |
| 57 | + ./scripts/generate-manifests-from-r2/generate-manifests \ |
| 58 | + --runtime="$RUNTIME" \ |
| 59 | + --output-dir=src/internal/manifest/data \ |
| 60 | + --base-url="https://builds.dtvem.io" \ |
| 61 | + --r2-endpoint="$R2_ENDPOINT" \ |
| 62 | + --r2-bucket="$R2_BUCKET" \ |
| 63 | + --r2-access-key="$R2_ACCESS_KEY" \ |
| 64 | + --r2-secret-key="$R2_SECRET_KEY" \ |
| 65 | + --dry-run |
| 66 | +
|
| 67 | + - name: Generate manifests |
| 68 | + if: ${{ github.event_name != 'workflow_dispatch' || !inputs.dry_run }} |
| 69 | + env: |
| 70 | + R2_ENDPOINT: https://${{ secrets.CLOUDFLARE_ACCOUNT_ID }}.r2.cloudflarestorage.com |
| 71 | + R2_BUCKET: ${{ secrets.CLOUDFLARE_R2_BUILDS_BUCKET }} |
| 72 | + R2_ACCESS_KEY: ${{ secrets.CLOUDFLARE_R2_ACCESS_KEY_ID }} |
| 73 | + R2_SECRET_KEY: ${{ secrets.CLOUDFLARE_R2_SECRET_ACCESS_KEY }} |
| 74 | + run: | |
| 75 | + RUNTIME="${{ inputs.runtime || 'all' }}" |
| 76 | + ./scripts/generate-manifests-from-r2/generate-manifests \ |
| 77 | + --runtime="$RUNTIME" \ |
| 78 | + --output-dir=src/internal/manifest/data \ |
| 79 | + --base-url="https://builds.dtvem.io" \ |
| 80 | + --r2-endpoint="$R2_ENDPOINT" \ |
| 81 | + --r2-bucket="$R2_BUCKET" \ |
| 82 | + --r2-access-key="$R2_ACCESS_KEY" \ |
| 83 | + --r2-secret-key="$R2_SECRET_KEY" |
| 84 | +
|
| 85 | + - name: Check for changes |
| 86 | + id: check-changes |
| 87 | + if: ${{ github.event_name != 'workflow_dispatch' || !inputs.dry_run }} |
| 88 | + run: | |
| 89 | + git diff --quiet src/internal/manifest/data/ || echo "changed=true" >> $GITHUB_OUTPUT |
| 90 | +
|
| 91 | + - name: Create Pull Request |
| 92 | + if: ${{ steps.check-changes.outputs.changed == 'true' }} |
| 93 | + uses: peter-evans/create-pull-request@v7 |
| 94 | + with: |
| 95 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 96 | + commit-message: 'chore(manifest): regenerate manifests from R2' |
| 97 | + title: 'chore(manifest): regenerate manifests from R2' |
| 98 | + body: | |
| 99 | + Regenerated manifests from binaries hosted on `builds.dtvem.io`. |
| 100 | +
|
| 101 | + This PR was created by the [Generate Manifests from R2 workflow](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}). |
| 102 | +
|
| 103 | + ## Changes |
| 104 | + - URLs now point to `builds.dtvem.io` (our hosted binaries) |
| 105 | + - Includes `sha256_source` field indicating checksum origin ("upstream" or "dtvem") |
| 106 | +
|
| 107 | + Please review the changes before merging. |
| 108 | + branch: chore/regenerate-manifests-from-r2 |
| 109 | + delete-branch: true |
| 110 | + labels: | |
| 111 | + automated |
| 112 | + manifest |
| 113 | +
|
| 114 | + - name: Generate summary |
| 115 | + if: always() |
| 116 | + run: | |
| 117 | + echo "## Manifest Generation" >> $GITHUB_STEP_SUMMARY |
| 118 | + echo "" >> $GITHUB_STEP_SUMMARY |
| 119 | + if [ "${{ inputs.dry_run }}" = "true" ]; then |
| 120 | + echo "**Mode:** Dry run (no changes made)" >> $GITHUB_STEP_SUMMARY |
| 121 | + elif [ "${{ steps.check-changes.outputs.changed }}" = "true" ]; then |
| 122 | + echo "**Result:** Changes detected, PR created" >> $GITHUB_STEP_SUMMARY |
| 123 | + else |
| 124 | + echo "**Result:** No changes detected" >> $GITHUB_STEP_SUMMARY |
| 125 | + fi |
0 commit comments