ctbcap: fix SC2059 #84
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: Build Push Containers | |
| on: | |
| push: | |
| branches: | |
| - master | |
| tags: | |
| - '*' | |
| schedule: | |
| - cron: '0 0 1 * *' # 00:00 (UTC) on every 1st of month. | |
| env: | |
| IMAGE_NAME: ctbcap | |
| jobs: | |
| build: | |
| strategy: | |
| matrix: | |
| include: [ | |
| { platform: 'linux/386', archname: 'x86', buildtype: 'minimal' }, | |
| { platform: 'linux/amd64', archname: 'x86_64', buildtype: 'minimal' }, | |
| { platform: 'linux/arm/v6', archname: 'armhf', buildtype: 'minimal' }, | |
| { platform: 'linux/arm/v7', archname: 'armv7', buildtype: 'minimal' }, | |
| { platform: 'linux/arm64/v8', archname: 'aarch64', buildtype: 'minimal' }, | |
| { platform: 'linux/loong64', archname: 'loongarch64', buildtype: 'minimal' }, | |
| { platform: 'linux/ppc64le', archname: 'ppc64le', buildtype: 'minimal' }, | |
| { platform: 'linux/riscv64', archname: 'riscv64', buildtype: 'minimal' }, | |
| { platform: 'linux/s390x', archname: 's390x', buildtype: 'fat' } # Free Actions Runner are not enough to run minimal build for s390x. | |
| ] | |
| name: Build Container for ${{ matrix.platform }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: kfermercer | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GHCR_TOKEN }} | |
| - name: Special Setup for Loongarch64 | |
| if: ${{ matrix.platform == 'linux/loong64' }} | |
| run: | | |
| docker run -t --rm --privileged ghcr.io/kfermercer/toolkit:loong64-qemu --reset -p yes | |
| sed -i 's|FROM alpine:latest|FROM lcr.loongnix.cn/library/alpine:latest|g' ./Dockerfile | |
| - name: Minimal build for ${{ matrix.archname }} | |
| if: ${{ matrix.buildtype == 'minimal' }} | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| platforms: ${{ matrix.platform }} | |
| provenance: false | |
| push: true | |
| tags: | | |
| kfermercer/${{ env.IMAGE_NAME }}:latest-${{ matrix.archname }} | |
| ghcr.io/kfermercer/${{ env.IMAGE_NAME }}:latest-${{ matrix.archname }} | |
| target: minimal | |
| - name: Fat build for ${{ matrix.archname }} | |
| if: ${{ matrix.buildtype == 'fat' }} | |
| uses: docker/build-push-action@v6 | |
| with: | |
| build-args: BUILD_TARGET=fat | |
| context: . | |
| platforms: ${{ matrix.platform }} | |
| provenance: false | |
| push: true | |
| tags: | | |
| kfermercer/${{ env.IMAGE_NAME }}:latest-${{ matrix.archname }} | |
| ghcr.io/kfermercer/${{ env.IMAGE_NAME }}:latest-${{ matrix.archname }} | |
| target: fat | |
| push: | |
| name: Push merged manifests | |
| runs-on: ubuntu-latest | |
| needs: build | |
| steps: | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: kfermercer | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GHCR_TOKEN }} | |
| - name: Create and push latest manifest to Docker Hub | |
| if: ${{ !startsWith(github.ref, 'refs/tags/') }} | |
| uses: Noelware/docker-manifest-action@v1 | |
| with: | |
| tags: | | |
| kfermercer/${{ env.IMAGE_NAME }}:latest | |
| inputs: | | |
| kfermercer/${{ env.IMAGE_NAME }}:latest-x86, | |
| kfermercer/${{ env.IMAGE_NAME }}:latest-x86_64, | |
| kfermercer/${{ env.IMAGE_NAME }}:latest-armhf, | |
| kfermercer/${{ env.IMAGE_NAME }}:latest-armv7, | |
| kfermercer/${{ env.IMAGE_NAME }}:latest-aarch64, | |
| kfermercer/${{ env.IMAGE_NAME }}:latest-loongarch64, | |
| kfermercer/${{ env.IMAGE_NAME }}:latest-ppc64le, | |
| kfermercer/${{ env.IMAGE_NAME }}:latest-riscv64, | |
| kfermercer/${{ env.IMAGE_NAME }}:latest-s390x | |
| push: true | |
| - name: Create and push latest manifest to GHCR | |
| if: ${{ !startsWith(github.ref, 'refs/tags/') }} | |
| uses: Noelware/docker-manifest-action@v1 | |
| with: | |
| tags: | | |
| ghcr.io/kfermercer/${{ env.IMAGE_NAME }}:latest | |
| inputs: | | |
| ghcr.io/kfermercer/${{ env.IMAGE_NAME }}:latest-x86, | |
| ghcr.io/kfermercer/${{ env.IMAGE_NAME }}:latest-x86_64, | |
| ghcr.io/kfermercer/${{ env.IMAGE_NAME }}:latest-armhf, | |
| ghcr.io/kfermercer/${{ env.IMAGE_NAME }}:latest-armv7, | |
| ghcr.io/kfermercer/${{ env.IMAGE_NAME }}:latest-aarch64, | |
| ghcr.io/kfermercer/${{ env.IMAGE_NAME }}:latest-loongarch64, | |
| ghcr.io/kfermercer/${{ env.IMAGE_NAME }}:latest-ppc64le, | |
| ghcr.io/kfermercer/${{ env.IMAGE_NAME }}:latest-riscv64, | |
| ghcr.io/kfermercer/${{ env.IMAGE_NAME }}:latest-s390x | |
| push: true | |
| - name: Store release version to env | |
| if: ${{ startsWith(github.ref, 'refs/tags/') }} | |
| run: echo "RELEASE_VERSION=${GITHUB_REF:10}" >> $GITHUB_ENV | |
| - name: Create and push release manifest to Docker Hub | |
| if: ${{ startsWith(github.ref, 'refs/tags/') }} | |
| uses: Noelware/docker-manifest-action@v1 | |
| with: | |
| tags: | | |
| kfermercer/${{ env.IMAGE_NAME }}:latest, | |
| kfermercer/${{ env.IMAGE_NAME }}:latest-release, | |
| kfermercer/${{ env.IMAGE_NAME }}:${{ env.RELEASE_VERSION }} | |
| inputs: | | |
| kfermercer/${{ env.IMAGE_NAME }}:latest-x86, | |
| kfermercer/${{ env.IMAGE_NAME }}:latest-x86_64, | |
| kfermercer/${{ env.IMAGE_NAME }}:latest-armhf, | |
| kfermercer/${{ env.IMAGE_NAME }}:latest-armv7, | |
| kfermercer/${{ env.IMAGE_NAME }}:latest-aarch64, | |
| kfermercer/${{ env.IMAGE_NAME }}:latest-loongarch64, | |
| kfermercer/${{ env.IMAGE_NAME }}:latest-ppc64le, | |
| kfermercer/${{ env.IMAGE_NAME }}:latest-riscv64, | |
| kfermercer/${{ env.IMAGE_NAME }}:latest-s390x | |
| push: true | |
| - name: Create and push release manifest to GHCR | |
| if: ${{ startsWith(github.ref, 'refs/tags/') }} | |
| uses: Noelware/docker-manifest-action@v1 | |
| with: | |
| tags: | | |
| ghcr.io/kfermercer/${{ env.IMAGE_NAME }}:latest, | |
| ghcr.io/kfermercer/${{ env.IMAGE_NAME }}:latest-release, | |
| ghcr.io/kfermercer/${{ env.IMAGE_NAME }}:${{ env.RELEASE_VERSION }} | |
| inputs: | | |
| ghcr.io/kfermercer/${{ env.IMAGE_NAME }}:latest-x86, | |
| ghcr.io/kfermercer/${{ env.IMAGE_NAME }}:latest-x86_64, | |
| ghcr.io/kfermercer/${{ env.IMAGE_NAME }}:latest-armhf, | |
| ghcr.io/kfermercer/${{ env.IMAGE_NAME }}:latest-armv7, | |
| ghcr.io/kfermercer/${{ env.IMAGE_NAME }}:latest-aarch64, | |
| ghcr.io/kfermercer/${{ env.IMAGE_NAME }}:latest-loongarch64, | |
| ghcr.io/kfermercer/${{ env.IMAGE_NAME }}:latest-ppc64le, | |
| ghcr.io/kfermercer/${{ env.IMAGE_NAME }}:latest-riscv64, | |
| ghcr.io/kfermercer/${{ env.IMAGE_NAME }}:latest-s390x | |
| push: true |