Repository navigation
chore(deps): update actions/checkout action to v7.0.1 (#159) #721
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: Docker Image CI | |
| on: | |
| push: | |
| branches: | |
| - main | |
| # Cancel in-progress runs when a new commit is pushed | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| build: | |
| permissions: | |
| packages: write | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| Docker_Image: | |
| [ | |
| alpine, | |
| ansible_runner, | |
| broken_link_checker, | |
| golang, | |
| hugo, | |
| markdown_server, | |
| minimal_ubuntu, | |
| node_build_tools, | |
| python_build_tools, | |
| speedtest, | |
| ] | |
| platform: | |
| - linux/amd64 | |
| - linux/arm64 | |
| # Run each platform on a native runner | |
| runs-on: ${{ matrix.platform == 'linux/arm64' && 'ubuntu-24.04-arm' || 'ubuntu-latest' }} | |
| steps: | |
| - uses: actions/checkout@v7.0.1 | |
| with: | |
| fetch-depth: 0 | |
| - name: Prepare platform env | |
| run: | | |
| platform=${{ matrix.platform }} | |
| echo "PLATFORM_PAIR=${platform////-}" >> "$GITHUB_ENV" | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v4 | |
| - name: Login to DockerHub | |
| uses: docker/login-action@v4 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Login to GitHub Packages (GHCR) | |
| uses: docker/login-action@v4 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build and push by digest | |
| id: build | |
| uses: docker/build-push-action@v7 | |
| with: | |
| context: . | |
| file: ${{ matrix.Docker_Image }}/Dockerfile | |
| platforms: ${{ matrix.platform }} | |
| outputs: type=image,"name=docker.io/crazyuploader/${{ matrix.Docker_Image }},ghcr.io/crazyuploader/${{ matrix.Docker_Image }}",push-by-digest=true,name-canonical=true,push=true | |
| cache-from: type=gha,scope=${{ matrix.Docker_Image }}-${{ env.PLATFORM_PAIR }} | |
| cache-to: type=gha,scope=${{ matrix.Docker_Image }}-${{ env.PLATFORM_PAIR }},mode=max | |
| - name: Export digest | |
| run: | | |
| mkdir -p "${{ runner.temp }}/digests" | |
| digest="${{ steps.build.outputs.digest }}" | |
| touch "${{ runner.temp }}/digests/${digest#sha256:}" | |
| - name: Upload digest artifact | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: digests-${{ matrix.Docker_Image }}-${{ env.PLATFORM_PAIR }} | |
| path: ${{ runner.temp }}/digests/* | |
| if-no-files-found: error | |
| retention-days: 1 | |
| merge: | |
| runs-on: ubuntu-latest | |
| needs: [build] | |
| permissions: | |
| packages: write | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| Docker_Image: | |
| [ | |
| alpine, | |
| ansible_runner, | |
| broken_link_checker, | |
| golang, | |
| hugo, | |
| markdown_server, | |
| minimal_ubuntu, | |
| node_build_tools, | |
| python_build_tools, | |
| speedtest, | |
| ] | |
| steps: | |
| - name: Download digests | |
| uses: actions/download-artifact@v8 | |
| with: | |
| path: ${{ runner.temp }}/digests | |
| pattern: digests-${{ matrix.Docker_Image }}-* | |
| merge-multiple: true | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v4 | |
| - name: Login to DockerHub | |
| uses: docker/login-action@v4 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Login to GitHub Packages (GHCR) | |
| uses: docker/login-action@v4 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Create and push manifest (DockerHub) | |
| working-directory: ${{ runner.temp }}/digests | |
| run: | | |
| docker buildx imagetools create \ | |
| -t docker.io/crazyuploader/${{ matrix.Docker_Image }}:latest \ | |
| $(printf 'docker.io/crazyuploader/${{ matrix.Docker_Image }}@sha256:%s ' *) | |
| - name: Create and push manifest (GHCR) | |
| working-directory: ${{ runner.temp }}/digests | |
| run: | | |
| docker buildx imagetools create \ | |
| -t ghcr.io/crazyuploader/${{ matrix.Docker_Image }}:latest \ | |
| $(printf 'ghcr.io/crazyuploader/${{ matrix.Docker_Image }}@sha256:%s ' *) | |
| - name: Inspect manifest | |
| run: | | |
| docker buildx imagetools inspect \ | |
| ghcr.io/crazyuploader/${{ matrix.Docker_Image }}:latest |