Do docker push in one combined rake task to decrease size of the images #8
Workflow file for this run
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
|
Check failure on line 1 in .github/workflows/release-images.yml
|
||
| name: Release docker images to GHCR | ||
| # | ||
| # This workflow assumes the maintainer has chosen the appropriate tag in the workflow dispatch UI. | ||
| # | ||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| tag: | ||
| description: "Tag name to release" | ||
| required: true | ||
| concurrency: | ||
| group: "${{github.workflow}}-${{github.ref}}" | ||
| cancel-in-progress: true | ||
| jobs: | ||
| build: | ||
| name: "build ${{ matrix.platform }} ${{ runner.arch }}" | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| os: | ||
| - ubuntu-latest | ||
| - ubuntu-24.04-arm | ||
| platform: | ||
| - aarch64-linux-gnu | ||
| - aarch64-linux-musl | ||
| - aarch64-mingw-ucrt | ||
| - arm-linux-gnu | ||
| - arm-linux-musl | ||
| - arm64-darwin | ||
| - jruby | ||
| - x64-mingw-ucrt | ||
| - x64-mingw32 | ||
| - x86-linux-gnu | ||
| - x86-linux-musl | ||
| - x86-mingw32 | ||
| - x86_64-darwin | ||
| - x86_64-linux-gnu | ||
| - x86_64-linux-musl | ||
| runs-on: ${{ matrix.os }} | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| ref: ${{ inputs.tag }} | ||
| - uses: ruby/setup-ruby@v1 | ||
| with: | ||
| ruby-version: "3.3" | ||
| bundler-cache: true | ||
| - name: Fetch docker buildx layer cache | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: tmp/build-cache-${{ runner.arch }} | ||
| key: ${{ runner.os }}-on-${{ runner.arch }}-${{ matrix.platform }}-buildx-${{ github.sha }} | ||
| restore-keys: ${{ runner.os }}-on-${{ runner.arch }}-${{ matrix.platform }}-buildx | ||
| enableCrossOsArchive: true | ||
| - name: Build the image for platform ${{ matrix.platform }} on ${{ runner.arch }} | ||
| run: | | ||
| # Change docker to a cache-able driver | ||
| docker buildx create --driver docker-container --use | ||
| bundle exec rake build:${{ matrix.platform }} RCD_DOCKER_BUILD="docker buildx build --cache-from=type=local,src=tmp/build-cache-${{ runner.arch }} --cache-to=type=local,dest=tmp/build-cache-new" | ||
| - name: Show docker images | ||
| run: docker images | ||
| - name: Update and prune docker buildx layer cache | ||
| run: | | ||
| rm -rf tmp/build-cache-${{ runner.arch }} | ||
| mv tmp/build-cache-new tmp/build-cache-${{ runner.arch }} | ||
| push: | ||
| name: push | ||
| needs: build | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| platform: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Use X64 cache from primary pipeline of aarch64-linux-gnu | ||
| uses: actions/cache/restore@v4 | ||
| with: | ||
| path: tmp/build-cache-X64 | ||
| key: ${{ runner.os }}-on-X64-aarch64-linux-gnu-buildx-${{ github.sha }} | ||
| restore-keys: ${{ runner.os }}-on-X64-aarch64-linux-gnu-buildx | ||
| enableCrossOsArchive: true | ||
| - run: mv tmp/build-cache-X64 tmp/build-cache-X64-aarch64-linux-gnu | ||
| - name: Use ARM64 cache from primary pipeline of aarch64-linux-gnu | ||
| uses: actions/cache/restore@v4 | ||
| with: | ||
| path: tmp/build-cache-ARM64 | ||
| key: ${{ runner.os }}-on-ARM64-aarch64-linux-gnu-buildx-${{ github.sha }} | ||
| restore-keys: ${{ runner.os }}-on-ARM64-aarch64-linux-gnu-buildx | ||
| enableCrossOsArchive: true | ||
| fail-on-cache-miss: true | ||
| - run: mv tmp/build-cache-ARM64 tmp/build-cache-ARM64-aarch64-linux-gnu | ||
| - name: Use X64 cache from primary pipeline of aarch64-linux-musl | ||
| uses: actions/cache/restore@v4 | ||
| with: | ||
| path: tmp/build-cache-X64 | ||
| key: ${{ runner.os }}-on-X64-aarch64-linux-musl-buildx-${{ github.sha }} | ||
| restore-keys: ${{ runner.os }}-on-X64-aarch64-linux-musl-buildx | ||
| enableCrossOsArchive: true | ||
| - run: mv tmp/build-cache-X64 tmp/build-cache-X64-aarch64-linux-musl | ||
| - name: Use ARM64 cache from primary pipeline of aarch64-linux-musl | ||
| uses: actions/cache/restore@v4 | ||
| with: | ||
| path: tmp/build-cache-ARM64 | ||
| key: ${{ runner.os }}-on-ARM64-aarch64-linux-musl-buildx-${{ github.sha }} | ||
| restore-keys: ${{ runner.os }}-on-ARM64-aarch64-linux-musl-buildx | ||
| enableCrossOsArchive: true | ||
| fail-on-cache-miss: true | ||
| - run: mv tmp/build-cache-ARM64 tmp/build-cache-ARM64-aarch64-linux-musl | ||
| - name: Use X64 cache from primary pipeline of aarch64-mingw-ucrt | ||
| uses: actions/cache/restore@v4 | ||
| with: | ||
| path: tmp/build-cache-X64 | ||
| key: ${{ runner.os }}-on-X64-aarch64-mingw-ucrt-buildx-${{ github.sha }} | ||
| restore-keys: ${{ runner.os }}-on-X64-aarch64-mingw-ucrt-buildx | ||
| enableCrossOsArchive: true | ||
| - run: mv tmp/build-cache-X64 tmp/build-cache-X64-aarch64-mingw-ucrt | ||
| - name: Use ARM64 cache from primary pipeline of aarch64-mingw-ucrt | ||
| uses: actions/cache/restore@v4 | ||
| with: | ||
| path: tmp/build-cache-ARM64 | ||
| key: ${{ runner.os }}-on-ARM64-aarch64-mingw-ucrt-buildx-${{ github.sha }} | ||
| restore-keys: ${{ runner.os }}-on-ARM64-aarch64-mingw-ucrt-buildx | ||
| enableCrossOsArchive: true | ||
| fail-on-cache-miss: true | ||
| - run: mv tmp/build-cache-ARM64 tmp/build-cache-ARM64-aarch64-mingw-ucrt | ||
| - name: Use X64 cache from primary pipeline of arm-linux-gnu | ||
| uses: actions/cache/restore@v4 | ||
| with: | ||
| path: tmp/build-cache-X64 | ||
| key: ${{ runner.os }}-on-X64-arm-linux-gnu-buildx-${{ github.sha }} | ||
| restore-keys: ${{ runner.os }}-on-X64-arm-linux-gnu-buildx | ||
| enableCrossOsArchive: true | ||
| - run: mv tmp/build-cache-X64 tmp/build-cache-X64-arm-linux-gnu | ||
| - name: Use ARM64 cache from primary pipeline of arm-linux-gnu | ||
| uses: actions/cache/restore@v4 | ||
| with: | ||
| path: tmp/build-cache-ARM64 | ||
| key: ${{ runner.os }}-on-ARM64-arm-linux-gnu-buildx-${{ github.sha }} | ||
| restore-keys: ${{ runner.os }}-on-ARM64-arm-linux-gnu-buildx | ||
| enableCrossOsArchive: true | ||
| fail-on-cache-miss: true | ||
| - run: mv tmp/build-cache-ARM64 tmp/build-cache-ARM64-arm-linux-gnu | ||
| - name: Use X64 cache from primary pipeline of arm-linux-musl | ||
| uses: actions/cache/restore@v4 | ||
| with: | ||
| path: tmp/build-cache-X64 | ||
| key: ${{ runner.os }}-on-X64-arm-linux-musl-buildx-${{ github.sha }} | ||
| restore-keys: ${{ runner.os }}-on-X64-arm-linux-musl-buildx | ||
| enableCrossOsArchive: true | ||
| - run: mv tmp/build-cache-X64 tmp/build-cache-X64-arm-linux-musl | ||
| - name: Use ARM64 cache from primary pipeline of arm-linux-musl | ||
| uses: actions/cache/restore@v4 | ||
| with: | ||
| path: tmp/build-cache-ARM64 | ||
| key: ${{ runner.os }}-on-ARM64-arm-linux-musl-buildx-${{ github.sha }} | ||
| restore-keys: ${{ runner.os }}-on-ARM64-arm-linux-musl-buildx | ||
| enableCrossOsArchive: true | ||
| fail-on-cache-miss: true | ||
| - run: mv tmp/build-cache-ARM64 tmp/build-cache-ARM64-arm-linux-musl | ||
| - name: Use X64 cache from primary pipeline of arm64-darwin | ||
| uses: actions/cache/restore@v4 | ||
| with: | ||
| path: tmp/build-cache-X64 | ||
| key: ${{ runner.os }}-on-X64-arm64-darwin-buildx-${{ github.sha }} | ||
| restore-keys: ${{ runner.os }}-on-X64-arm64-darwin-buildx | ||
| enableCrossOsArchive: true | ||
| - run: mv tmp/build-cache-X64 tmp/build-cache-X64-arm64-darwin | ||
| - name: Use ARM64 cache from primary pipeline of arm64-darwin | ||
| uses: actions/cache/restore@v4 | ||
| with: | ||
| path: tmp/build-cache-ARM64 | ||
| key: ${{ runner.os }}-on-ARM64-arm64-darwin-buildx-${{ github.sha }} | ||
| restore-keys: ${{ runner.os }}-on-ARM64-arm64-darwin-buildx | ||
| enableCrossOsArchive: true | ||
| fail-on-cache-miss: true | ||
| - run: mv tmp/build-cache-ARM64 tmp/build-cache-ARM64-arm64-darwin | ||
| - name: Use X64 cache from primary pipeline of jruby | ||
| uses: actions/cache/restore@v4 | ||
| with: | ||
| path: tmp/build-cache-X64 | ||
| key: ${{ runner.os }}-on-X64-jruby-buildx-${{ github.sha }} | ||
| restore-keys: ${{ runner.os }}-on-X64-jruby-buildx | ||
| enableCrossOsArchive: true | ||
| - run: mv tmp/build-cache-X64 tmp/build-cache-X64-jruby | ||
| - name: Use ARM64 cache from primary pipeline of jruby | ||
| uses: actions/cache/restore@v4 | ||
| with: | ||
| path: tmp/build-cache-ARM64 | ||
| key: ${{ runner.os }}-on-ARM64-jruby-buildx-${{ github.sha }} | ||
| restore-keys: ${{ runner.os }}-on-ARM64-jruby-buildx | ||
| enableCrossOsArchive: true | ||
| fail-on-cache-miss: true | ||
| - run: mv tmp/build-cache-ARM64 tmp/build-cache-ARM64-jruby | ||
| - name: Use X64 cache from primary pipeline of x64-mingw-ucrt | ||
| uses: actions/cache/restore@v4 | ||
| with: | ||
| path: tmp/build-cache-X64 | ||
| key: ${{ runner.os }}-on-X64-x64-mingw-ucrt-buildx-${{ github.sha }} | ||
| restore-keys: ${{ runner.os }}-on-X64-x64-mingw-ucrt-buildx | ||
| enableCrossOsArchive: true | ||
| - run: mv tmp/build-cache-X64 tmp/build-cache-X64-x64-mingw-ucrt | ||
| - name: Use ARM64 cache from primary pipeline of x64-mingw-ucrt | ||
| uses: actions/cache/restore@v4 | ||
| with: | ||
| path: tmp/build-cache-ARM64 | ||
| key: ${{ runner.os }}-on-ARM64-x64-mingw-ucrt-buildx-${{ github.sha }} | ||
| restore-keys: ${{ runner.os }}-on-ARM64-x64-mingw-ucrt-buildx | ||
| enableCrossOsArchive: true | ||
| fail-on-cache-miss: true | ||
| - run: mv tmp/build-cache-ARM64 tmp/build-cache-ARM64-x64-mingw-ucrt | ||
| - name: Use X64 cache from primary pipeline of x64-mingw32 | ||
| uses: actions/cache/restore@v4 | ||
| with: | ||
| path: tmp/build-cache-X64 | ||
| key: ${{ runner.os }}-on-X64-x64-mingw32-buildx-${{ github.sha }} | ||
| restore-keys: ${{ runner.os }}-on-X64-x64-mingw32-buildx | ||
| enableCrossOsArchive: true | ||
| - run: mv tmp/build-cache-X64 tmp/build-cache-X64-x64-mingw32 | ||
| - name: Use ARM64 cache from primary pipeline of x64-mingw32 | ||
| uses: actions/cache/restore@v4 | ||
| with: | ||
| path: tmp/build-cache-ARM64 | ||
| key: ${{ runner.os }}-on-ARM64-x64-mingw32-buildx-${{ github.sha }} | ||
| restore-keys: ${{ runner.os }}-on-ARM64-x64-mingw32-buildx | ||
| enableCrossOsArchive: true | ||
| fail-on-cache-miss: true | ||
| - run: mv tmp/build-cache-ARM64 tmp/build-cache-ARM64-x64-mingw32 | ||
| - name: Use X64 cache from primary pipeline of x86-linux-gnu | ||
| uses: actions/cache/restore@v4 | ||
| with: | ||
| path: tmp/build-cache-X64 | ||
| key: ${{ runner.os }}-on-X64-x86-linux-gnu-buildx-${{ github.sha }} | ||
| restore-keys: ${{ runner.os }}-on-X64-x86-linux-gnu-buildx | ||
| enableCrossOsArchive: true | ||
| - run: mv tmp/build-cache-X64 tmp/build-cache-X64-x86-linux-gnu | ||
| - name: Use ARM64 cache from primary pipeline of x86-linux-gnu | ||
| uses: actions/cache/restore@v4 | ||
| with: | ||
| path: tmp/build-cache-ARM64 | ||
| key: ${{ runner.os }}-on-ARM64-x86-linux-gnu-buildx-${{ github.sha }} | ||
| restore-keys: ${{ runner.os }}-on-ARM64-x86-linux-gnu-buildx | ||
| enableCrossOsArchive: true | ||
| fail-on-cache-miss: true | ||
| - run: mv tmp/build-cache-ARM64 tmp/build-cache-ARM64-x86-linux-gnu | ||
| - name: Use X64 cache from primary pipeline of x86-linux-musl | ||
| uses: actions/cache/restore@v4 | ||
| with: | ||
| path: tmp/build-cache-X64 | ||
| key: ${{ runner.os }}-on-X64-x86-linux-musl-buildx-${{ github.sha }} | ||
| restore-keys: ${{ runner.os }}-on-X64-x86-linux-musl-buildx | ||
| enableCrossOsArchive: true | ||
| - run: mv tmp/build-cache-X64 tmp/build-cache-X64-x86-linux-musl | ||
| - name: Use ARM64 cache from primary pipeline of x86-linux-musl | ||
| uses: actions/cache/restore@v4 | ||
| with: | ||
| path: tmp/build-cache-ARM64 | ||
| key: ${{ runner.os }}-on-ARM64-x86-linux-musl-buildx-${{ github.sha }} | ||
| restore-keys: ${{ runner.os }}-on-ARM64-x86-linux-musl-buildx | ||
| enableCrossOsArchive: true | ||
| fail-on-cache-miss: true | ||
| - run: mv tmp/build-cache-ARM64 tmp/build-cache-ARM64-x86-linux-musl | ||
| - name: Use X64 cache from primary pipeline of x86-mingw32 | ||
| uses: actions/cache/restore@v4 | ||
| with: | ||
| path: tmp/build-cache-X64 | ||
| key: ${{ runner.os }}-on-X64-x86-mingw32-buildx-${{ github.sha }} | ||
| restore-keys: ${{ runner.os }}-on-X64-x86-mingw32-buildx | ||
| enableCrossOsArchive: true | ||
| - run: mv tmp/build-cache-X64 tmp/build-cache-X64-x86-mingw32 | ||
| - name: Use ARM64 cache from primary pipeline of x86-mingw32 | ||
| uses: actions/cache/restore@v4 | ||
| with: | ||
| path: tmp/build-cache-ARM64 | ||
| key: ${{ runner.os }}-on-ARM64-x86-mingw32-buildx-${{ github.sha }} | ||
| restore-keys: ${{ runner.os }}-on-ARM64-x86-mingw32-buildx | ||
| enableCrossOsArchive: true | ||
| fail-on-cache-miss: true | ||
| - run: mv tmp/build-cache-ARM64 tmp/build-cache-ARM64-x86-mingw32 | ||
| - name: Use X64 cache from primary pipeline of x86_64-darwin | ||
| uses: actions/cache/restore@v4 | ||
| with: | ||
| path: tmp/build-cache-X64 | ||
| key: ${{ runner.os }}-on-X64-x86_64-darwin-buildx-${{ github.sha }} | ||
| restore-keys: ${{ runner.os }}-on-X64-x86_64-darwin-buildx | ||
| enableCrossOsArchive: true | ||
| - run: mv tmp/build-cache-X64 tmp/build-cache-X64-x86_64-darwin | ||
| - name: Use ARM64 cache from primary pipeline of x86_64-darwin | ||
| uses: actions/cache/restore@v4 | ||
| with: | ||
| path: tmp/build-cache-ARM64 | ||
| key: ${{ runner.os }}-on-ARM64-x86_64-darwin-buildx-${{ github.sha }} | ||
| restore-keys: ${{ runner.os }}-on-ARM64-x86_64-darwin-buildx | ||
| enableCrossOsArchive: true | ||
| fail-on-cache-miss: true | ||
| - run: mv tmp/build-cache-ARM64 tmp/build-cache-ARM64-x86_64-darwin | ||
| - name: Use X64 cache from primary pipeline of x86_64-linux-gnu | ||
| uses: actions/cache/restore@v4 | ||
| with: | ||
| path: tmp/build-cache-X64 | ||
| key: ${{ runner.os }}-on-X64-x86_64-linux-gnu-buildx-${{ github.sha }} | ||
| restore-keys: ${{ runner.os }}-on-X64-x86_64-linux-gnu-buildx | ||
| enableCrossOsArchive: true | ||
| - run: mv tmp/build-cache-X64 tmp/build-cache-X64-x86_64-linux-gnu | ||
| - name: Use ARM64 cache from primary pipeline of x86_64-linux-gnu | ||
| uses: actions/cache/restore@v4 | ||
| with: | ||
| path: tmp/build-cache-ARM64 | ||
| key: ${{ runner.os }}-on-ARM64-x86_64-linux-gnu-buildx-${{ github.sha }} | ||
| restore-keys: ${{ runner.os }}-on-ARM64-x86_64-linux-gnu-buildx | ||
| enableCrossOsArchive: true | ||
| fail-on-cache-miss: true | ||
| - run: mv tmp/build-cache-ARM64 tmp/build-cache-ARM64-x86_64-linux-gnu | ||
| - name: Use X64 cache from primary pipeline of x86_64-linux-musl | ||
| uses: actions/cache/restore@v4 | ||
| with: | ||
| path: tmp/build-cache-X64 | ||
| key: ${{ runner.os }}-on-X64-x86_64-linux-musl-buildx-${{ github.sha }} | ||
| restore-keys: ${{ runner.os }}-on-X64-x86_64-linux-musl-buildx | ||
| enableCrossOsArchive: true | ||
| - run: mv tmp/build-cache-X64 tmp/build-cache-X64-x86_64-linux-musl | ||
| - name: Use ARM64 cache from primary pipeline of x86_64-linux-musl | ||
| uses: actions/cache/restore@v4 | ||
| with: | ||
| path: tmp/build-cache-ARM64 | ||
| key: ${{ runner.os }}-on-ARM64-x86_64-linux-musl-buildx-${{ github.sha }} | ||
| restore-keys: ${{ runner.os }}-on-ARM64-x86_64-linux-musl-buildx | ||
| enableCrossOsArchive: true | ||
| fail-on-cache-miss: true | ||
| - run: mv tmp/build-cache-ARM64 tmp/build-cache-ARM64-x86_64-linux-musl | ||
| - uses: ruby/setup-ruby@v1 | ||
| with: | ||
| ruby-version: "3.3" | ||
| bundler-cache: true | ||
| - uses: docker/login-action@v3 | ||
| with: | ||
| registry: ghcr.io | ||
| username: ${{github.actor}} | ||
| password: ${{secrets.GITHUB_TOKEN}} | ||
| - name: Use cache and push docker image | ||
| env: | ||
| RCD_IMAGE_VERSION: snapshot | ||
| RCD_DOCKER_BUILD: docker buildx build --cache-from=type=local,src=tmp/build-cache-X64-aarch64-linux-gnu --cache-from=type=local,src=tmp/build-cache-ARM64-aarch64-linux-gnu --cache-from=type=local,src=tmp/build-cache-X64-aarch64-linux-musl --cache-from=type=local,src=tmp/build-cache-ARM64-aarch64-linux-musl --cache-from=type=local,src=tmp/build-cache-X64-aarch64-mingw-ucrt --cache-from=type=local,src=tmp/build-cache-ARM64-aarch64-mingw-ucrt --cache-from=type=local,src=tmp/build-cache-X64-arm-linux-gnu --cache-from=type=local,src=tmp/build-cache-ARM64-arm-linux-gnu --cache-from=type=local,src=tmp/build-cache-X64-arm-linux-musl --cache-from=type=local,src=tmp/build-cache-ARM64-arm-linux-musl --cache-from=type=local,src=tmp/build-cache-X64-arm64-darwin --cache-from=type=local,src=tmp/build-cache-ARM64-arm64-darwin --cache-from=type=local,src=tmp/build-cache-X64-jruby --cache-from=type=local,src=tmp/build-cache-ARM64-jruby --cache-from=type=local,src=tmp/build-cache-X64-x64-mingw-ucrt --cache-from=type=local,src=tmp/build-cache-ARM64-x64-mingw-ucrt --cache-from=type=local,src=tmp/build-cache-X64-x64-mingw32 --cache-from=type=local,src=tmp/build-cache-ARM64-x64-mingw32 --cache-from=type=local,src=tmp/build-cache-X64-x86-linux-gnu --cache-from=type=local,src=tmp/build-cache-ARM64-x86-linux-gnu --cache-from=type=local,src=tmp/build-cache-X64-x86-linux-musl --cache-from=type=local,src=tmp/build-cache-ARM64-x86-linux-musl --cache-from=type=local,src=tmp/build-cache-X64-x86-mingw32 --cache-from=type=local,src=tmp/build-cache-ARM64-x86-mingw32 --cache-from=type=local,src=tmp/build-cache-X64-x86_64-darwin --cache-from=type=local,src=tmp/build-cache-ARM64-x86_64-darwin --cache-from=type=local,src=tmp/build-cache-X64-x86_64-linux-gnu --cache-from=type=local,src=tmp/build-cache-ARM64-x86_64-linux-gnu --cache-from=type=local,src=tmp/build-cache-X64-x86_64-linux-musl --cache-from=type=local,src=tmp/build-cache-ARM64-x86_64-linux-musl --cache-to=type=local,dest=tmp/build-cache-new | ||
| run: | | ||
| docker buildx create --driver docker-container --use | ||
| bundle exec rake release | ||