github-packages.yml 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. ---
  2. name: github-packages
  3. on:
  4. push:
  5. branches:
  6. - '6.*'
  7. - '5.*'
  8. # Allows you to run this workflow manually from the Actions tab
  9. workflow_dispatch:
  10. inputs:
  11. dists:
  12. description: list of dists to build, coma separated. xenial,sid
  13. required: false
  14. type: string
  15. env:
  16. REGISTRY_NAME: ghcr.io
  17. IMAGE_NAME: kamailio
  18. REGISTRY_IMAGE: kamailio/kamailio
  19. jobs:
  20. pre-docker:
  21. runs-on: ubuntu-latest
  22. steps:
  23. - uses: actions/checkout@v4
  24. - id: set-matrix
  25. run: |
  26. sudo apt-get install jq
  27. echo "matrix=$(bash get-all-dist.sh ${{ github.event.inputs.dists }})" >> $GITHUB_OUTPUT
  28. outputs:
  29. dist: ${{ steps.set-matrix.outputs.matrix }}
  30. docker:
  31. needs: pre-docker
  32. runs-on: ubuntu-latest
  33. permissions:
  34. contents: read
  35. packages: write
  36. strategy:
  37. fail-fast: false
  38. matrix:
  39. dist: ${{fromJson(needs.pre-docker.outputs.dist)}}
  40. steps:
  41. - name: Set up QEMU
  42. uses: docker/setup-qemu-action@v3
  43. - name: Set up Docker Buildx
  44. uses: docker/setup-buildx-action@v3
  45. - name: Login to GitHub Registry
  46. uses: docker/login-action@v3
  47. with:
  48. registry: ${{ env.REGISTRY_NAME }}
  49. username: ${{ github.actor }}
  50. password: ${{ secrets.GITHUB_TOKEN }}
  51. - name: Docker meta
  52. id: meta
  53. uses: docker/metadata-action@v5
  54. with:
  55. images: ${{ env.REGISTRY_NAME }}/${{ env.REGISTRY_IMAGE }}
  56. tags: |
  57. type=raw,value=${{ github.ref_name }}-${{ matrix.dist }}
  58. labels: |
  59. org.opencontainers.image.title=${{ env.IMAGE_NAME }}
  60. org.opencontainers.image.description=official Debian base image
  61. env:
  62. DOCKER_METADATA_ANNOTATIONS_LEVELS: manifest,index
  63. - name: Build and push
  64. uses: docker/build-push-action@v6
  65. with:
  66. context: "{{defaultContext}}:${{ matrix.dist }}"
  67. # we need to build for arm64 first at kamailio.sipwise.com
  68. # platforms: linux/amd64,linux/arm64
  69. labels: ${{ steps.meta.outputs.labels }}
  70. push: true
  71. tags: ${{ steps.meta.outputs.tags }}
  72. annotations: ${{ steps.meta.outputs.annotations }}