ci: Publish docker images also for ref/tags/v #11
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
| name: Release | |
| permissions: | |
| contents: read | |
| on: | |
| push: | |
| tags: | |
| - "*" | |
| jobs: | |
| build: | |
| name: Build executable | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| arch: [amd64] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Prepare | |
| run: chmod u+x .github/workflows/generic-build.sh .github/workflows/ci-run-tests.sh | |
| - name: Build for matrix.arch == amd64 | |
| run: | | |
| sudo .github/workflows/generic-build.sh ${{ matrix.arch }} | |
| sudo .github/workflows/ci-run-tests.sh ${{ matrix.arch }} | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: kcov-${{ matrix.arch }}.tar.gz | |
| path: kcov-${{ matrix.arch }}.tar.gz | |
| build-and-push-docker-image: | |
| name: Build and push to Docker Hub | |
| needs: [build] | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - { | |
| BUILD_OS: "alpine", | |
| IMAGE_TAG_SUFFIX: "-alpine", | |
| PLATFORM: "linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64/v8,linux/riscv64" | |
| } | |
| - { | |
| BUILD_OS: "debian", | |
| IMAGE_TAG_SUFFIX: "", | |
| PLATFORM: "linux/386,linux/amd64,linux/arm/v5,linux/arm/v7,linux/arm64/v8" | |
| } | |
| environment: | |
| name: "Docker Hub" | |
| url: https://hub.docker.com/r/kcov/kcov | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| fetch-tags: true | |
| - name: Docker Hub login | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKER_USERNAME }} | |
| password: ${{ secrets.DOCKER_PASSWORD }} | |
| # https://github.com/docker/setup-qemu-action | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| # https://github.com/docker/setup-buildx-action | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Build and push the docker image (v${{ env.RELEASE_TAG }}/${{ matrix.BUILD_OS }}) | |
| run: .github/workflows/docker-build.sh ${{ matrix.BUILD_OS }} | |
| env: | |
| ACTION: push | |
| IMAGE_TAG: kcov/kcov:${{ env.RELEASE_TAG }}${{ matrix.IMAGE_TAG_SUFFIX }} | |
| # All (built on the base image): | |
| # - linux/386 | |
| # - linux/amd64 | |
| # - linux/arm/v6 -> Only Alpine | |
| # - linux/arm/v5 -> Only Debian | |
| # - linux/arm/v7 | |
| # - linux/arm64/v8 | |
| # - linux/ppc64le | |
| # - linux/mips64le | |
| # - linux/riscv64 -> Only Alpine | |
| # - linux/s390x | |
| # Does not build: | |
| # - linux/s390x | |
| # - linux/mips64le | |
| # No users on this platform: | |
| # - linux/ppc64le | |
| PLATFORM: ${{ matrix.PLATFORM }} | |
| create_release: | |
| name: Create release | |
| needs: [build-and-push-docker-image] | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/download-artifact@v4 | |
| - name: Create release | |
| uses: ncipollo/release-action@v1 | |
| with: | |
| allowUpdates: true | |
| artifacts: kcov-*/kcov-*.tar.gz | |
| artifactContentType: application/gzip | |
| token: ${{ secrets.GITHUB_TOKEN }} |