Download Runtimes #5
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: Download Runtimes | |
| on: | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| packages: write | |
| jobs: | |
| download-runtimes: | |
| name: Download Runtime Binaries | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: '1.24' | |
| cache: true | |
| - name: Build cdprun binary | |
| run: make build-only | |
| - name: Set up ORAS | |
| run: | | |
| go install oras.land/oras/cmd/oras@v1.3.0 | |
| echo "$(go env GOPATH)/bin" >> $GITHUB_PATH | |
| oras version | |
| - name: Login to GHCR | |
| run: | | |
| echo "${{ secrets.GITHUB_TOKEN }}" | oras login ghcr.io -u ${{ github.actor }} --password-stdin | |
| - name: Download previous downloads.db from GHCR | |
| run: | | |
| REPO_LOWER=$(echo "${{ github.repository }}" | tr '[:upper:]' '[:lower:]') | |
| echo "Attempting to download existing database from ghcr.io/${REPO_LOWER}/downloads-db:latest" | |
| oras pull ghcr.io/${REPO_LOWER}/downloads-db:latest -o . || echo "No existing database found, starting fresh" | |
| continue-on-error: true | |
| - name: Run download command | |
| run: ./bin/cdprun download | |
| - name: Upload downloads.db to GHCR | |
| run: | | |
| REPO_LOWER=$(echo "${{ github.repository }}" | tr '[:upper:]' '[:lower:]') | |
| echo "Uploading database to ghcr.io/${REPO_LOWER}/downloads-db:latest" | |
| oras push ghcr.io/${REPO_LOWER}/downloads-db:latest ./downloads.db |