| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301 |
- name: Docker
- on:
- push:
- branches: ["master"]
- tags: ["docker/*"]
- pull_request:
- branches: ["master"]
- schedule:
- - cron: "13 13 * * 3"
- concurrency:
- group: ${{ github.workflow }}-${{ github.ref }}
- cancel-in-progress: true
- jobs:
- ############
- # Building #
- ############
- build:
- strategy:
- fail-fast: false
- matrix:
- dist: ["alpine", "debian"]
- arch:
- - amd64
- - arm32v6
- - arm32v7
- - arm64v8
- - i386
- - ppc64le
- - s390x
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v4
- with:
- fetch-depth: 0 # for correct image labeling via `git describe --tags`
- - uses: docker/setup-buildx-action@v3
- - name: Configure `max-parallelism = 1` for Docker BuildKit
- run: sudo echo "[worker.oci]\nmax-parallelism = 1"
- >> /etc/buildkitd.toml
- if: ${{ matrix.arch == 'ppc64le' }}
- - name: Create Docker BuildKit builder
- run: docker buildx create --use --name container \
- --driver docker-container \
- --config /etc/buildkitd.toml
- if: ${{ matrix.arch == 'ppc64le' }}
- - name: Detect correct Git ref for image build
- id: git
- uses: actions/github-script@v7
- with:
- script: |
- let out = {ref: 'HEAD', ver: ''};
- if ('${{ github.ref }}'.startsWith('refs/tags/docker/')) {
- out.ref = '${{ github.ref }}'.substring(17).split('-')[0];
- out.ver = out.ref;
- }
- return out;
- - name: Verify Git ref matches Makefile version
- run: |
- test "${{ fromJSON(steps.git.outputs.result).ref }}" \
- == "$(grep -m1 'COTURN_VER ?=' Makefile | cut -d'=' -f2 | tr -d ' ')"
- working-directory: docker/coturn/
- if: ${{ github.event_name == 'push'
- && startsWith(github.ref, 'refs/tags/docker/') }}
- - run: make docker.image no-cache=yes
- dockerfile=${{ matrix.dist }}
- platform=linux/${{ matrix.arch }}
- ref=${{ fromJSON(steps.git.outputs.result).ref }}
- tag=build-${{ github.run_number }}-${{ matrix.dist }}-${{ matrix.arch }}
- working-directory: docker/coturn/
- - run: make docker.tar to-file=.cache/image.tar
- tags=build-${{ github.run_number }}-${{ matrix.dist }}-${{ matrix.arch }}
- working-directory: docker/coturn/
- - uses: actions/upload-artifact@v4
- with:
- name: ${{ matrix.dist }}-${{ matrix.arch }}-${{ github.run_number }}
- path: docker/coturn/.cache/image.tar
- retention-days: 1
- ###########
- # Testing #
- ###########
- test:
- needs: ["build"]
- strategy:
- fail-fast: false
- matrix:
- dist: ["alpine", "debian"]
- arch:
- - amd64
- - arm32v6
- - arm32v7
- - arm64v8
- - i386
- - ppc64le
- - s390x
- # TODO: Try remove on new QEMU or Coturn versions.
- # Temporarily exclude `alpine` on `s390x` arch, as QEMU emulation
- # currently times out and fails the CI.
- exclude:
- - dist: alpine
- arch: s390x
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v4
- - uses: docker/setup-qemu-action@v3
- - run: make npm.install
- working-directory: docker/coturn/
- - name: Detect correct Git version for image tests
- id: git
- uses: actions/github-script@v7
- with:
- script: |
- let out = {ref: 'HEAD', ver: ''};
- if ('${{ github.ref }}'.startsWith('refs/tags/docker/')) {
- out.ref = '${{ github.ref }}'.substring(17).split('-')[0];
- out.ver = out.ref;
- }
- return out;
- - uses: actions/download-artifact@v4
- with:
- name: ${{ matrix.dist }}-${{ matrix.arch }}-${{ github.run_number }}
- path: docker/coturn/.cache/
- - run: make docker.untar from-file=.cache/image.tar
- working-directory: docker/coturn/
- - run: make test.docker
- platform=linux/${{ matrix.arch }}
- tag=build-${{ github.run_number }}-${{ matrix.dist }}-${{ matrix.arch }}
- env:
- COTURN_VERSION: ${{ fromJSON(steps.git.outputs.result).ver }}
- working-directory: docker/coturn/
- #############
- # Releasing #
- #############
- push:
- if: ${{ github.event_name == 'push'
- && github.repository_owner == 'coturn'
- && (startsWith(github.ref, 'refs/tags/')
- || github.ref == 'refs/heads/master') }}
- needs: ["build", "test"]
- strategy:
- fail-fast: false
- max-parallel: 1
- matrix:
- registry: ["docker.io", "ghcr.io", "quay.io"]
- dist: ["alpine", "debian"]
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v4
- - name: Parse Docker image name from Git repository name
- id: image
- uses: actions-ecosystem/action-regex-match@v2
- with:
- text: ${{ github.repository }}
- regex: '^${{ github.repository_owner }}/(.+)$'
- - name: Parse semver versions from Git tag
- id: semver
- uses: actions-ecosystem/action-regex-match@v2
- with:
- text: ${{ github.ref }}
- regex: '^refs/tags/docker/(((([0-9]+)\.[0-9]+)\.[0-9]+)-(.+))$'
- if: ${{ startsWith(github.ref, 'refs/tags/') }}
- - name: Form main Docker image tag
- id: docker
- run: echo "tag=${{ (startsWith(github.ref, 'refs/tags/')
- && steps.semver.outputs.group1)
- || 'edge' }}-${{ matrix.dist }}"
- >> $GITHUB_OUTPUT
- - uses: actions/download-artifact@v4
- with:
- path: docker/coturn/.cache/
- - name: Login to ${{ matrix.registry }} container registry
- uses: docker/login-action@v3
- with:
- registry: ${{ matrix.registry }}
- username: ${{ (matrix.registry == 'docker.io'
- && secrets.DOCKERHUB_BOT_USER)
- || (matrix.registry == 'quay.io'
- && secrets.QUAYIO_ROBOT_USERNAME)
- || github.repository_owner }}
- password: ${{ (matrix.registry == 'docker.io'
- && secrets.DOCKERHUB_BOT_PASS)
- || (matrix.registry == 'quay.io'
- && secrets.QUAYIO_ROBOT_TOKEN)
- || secrets.GITHUB_TOKEN }}
- - name: Tag and push single-platform images
- run: |
- for arch in amd64 \
- arm32v6 \
- arm32v7 \
- arm64v8 \
- i386 \
- ppc64le \
- s390x
- do
- make docker.untar \
- from-file=.cache/${{ matrix.dist }}-$arch-${{ github.run_number }}/image.tar
- make docker.tags \
- of=build-${{ github.run_number }}-${{ matrix.dist }}-$arch \
- tags=${{ steps.docker.outputs.tag }}-$arch \
- registries=${{ matrix.registry }}
- make docker.push \
- tags=${{ steps.docker.outputs.tag }}-$arch \
- registries=${{ matrix.registry }}
- done
- working-directory: docker/coturn/
- - name: Tag and push multi-platform images
- run: make docker.manifest push=yes
- registries=${{ matrix.registry }}
- of='${{ steps.docker.outputs.tag }}-amd64
- ${{ steps.docker.outputs.tag }}-arm32v6
- ${{ steps.docker.outputs.tag }}-arm32v7
- ${{ steps.docker.outputs.tag }}-arm64v8
- ${{ steps.docker.outputs.tag }}-i386
- ${{ steps.docker.outputs.tag }}-ppc64le
- ${{ steps.docker.outputs.tag }}-s390x'
- tags=${{ (!startsWith(github.ref, 'refs/tags/')
- && steps.docker.outputs.tag)
- || '' }}
- env:
- DOCKERFILE: ${{ matrix.dist }} # for correct `tags` auto-detection
- working-directory: docker/coturn/
- # On GitHub Container Registry README is automatically updated on pushes.
- - name: Update README on Docker Hub
- uses: christian-korneck/update-container-description-action@v1
- with:
- provider: dockerhub
- destination_container_repo: ${{ github.repository_owner }}/${{ steps.image.outputs.group1 }}
- readme_file: docker/coturn/README.md
- env:
- DOCKER_USER: ${{ secrets.DOCKERHUB_BOT_USER }}
- DOCKER_PASS: ${{ secrets.DOCKERHUB_BOT_PASS }}
- if: ${{ startsWith(github.ref, 'refs/tags/')
- && matrix.registry == 'docker.io' }}
- - name: Update README on Quay.io
- uses: christian-korneck/update-container-description-action@v1
- with:
- provider: quay
- destination_container_repo: ${{ matrix.registry }}/${{ github.repository_owner }}/${{ steps.image.outputs.group1 }}
- readme_file: docker/coturn/README.md
- env:
- DOCKER_APIKEY: ${{ secrets.QUAYIO_API_TOKEN }}
- if: ${{ startsWith(github.ref, 'refs/tags/')
- && matrix.registry == 'quay.io' }}
- release-github:
- name: release (GitHub)
- if: ${{ github.event_name == 'push'
- && github.repository_owner == 'coturn'
- && startsWith(github.ref, 'refs/tags/') }}
- needs: ["push"]
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v4
- - name: Parse semver versions from Git tag
- id: semver
- uses: actions-ecosystem/action-regex-match@v2
- with:
- text: ${{ github.ref }}
- regex: '^refs/tags/docker/(((([0-9]+)\.[0-9]+)\.[0-9]+)-(.+))$'
- - name: Parse CHANGELOG link
- id: changelog
- run: echo "link=${{ github.server_url }}/${{ github.repository }}/blob/docker/${{ steps.semver.outputs.group1 }}/docker/coturn/CHANGELOG.md#$(sed -n '/^## \[${{ steps.semver.outputs.group1 }}\]/{s/^## \[\(.*\)\][^0-9]*\([0-9].*\)/\1--\2/;s/[^0-9a-z-]*//g;p;}' CHANGELOG.md)"
- >> $GITHUB_OUTPUT
- working-directory: docker/coturn/
- - name: Create GitHub release
- uses: softprops/action-gh-release@v2
- with:
- name: docker/${{ steps.semver.outputs.group1 }}
- body: |
- `${{ steps.semver.outputs.group1 }}` Docker image version of ${{ steps.semver.outputs.group2 }} Coturn release.
- [Docker Hub](https://hub.docker.com/r/coturn/coturn) | [GitHub Container Registry](https://github.com/orgs/coturn/packages/container/package/coturn) | [Quay.io](https://quay.io/repository/coturn/coturn)
- [Changelog](${{ steps.changelog.outputs.link }})
|