ghcr.yml 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. name: Publish Docker Image
  2. concurrency:
  3. group: ${{ github.workflow }}-${{ github.ref }}
  4. cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
  5. on:
  6. push:
  7. branches:
  8. - main
  9. tags:
  10. - '*'
  11. pull_request:
  12. workflow_dispatch:
  13. inputs:
  14. reason:
  15. description: 'Reason for manual trigger'
  16. required: true
  17. default: ''
  18. jobs:
  19. ghcr_build_and_push:
  20. runs-on: ubuntu-latest
  21. permissions:
  22. contents: read
  23. packages: write
  24. strategy:
  25. matrix:
  26. image: ["app", "sandbox"]
  27. steps:
  28. - name: checkout
  29. uses: actions/checkout@v4
  30. - name: Free Disk Space (Ubuntu)
  31. uses: jlumbroso/free-disk-space@main
  32. with:
  33. # this might remove tools that are actually needed,
  34. # if set to "true" but frees about 6 GB
  35. tool-cache: true
  36. # all of these default to true, but feel free to set to
  37. # "false" if necessary for your workflow
  38. android: true
  39. dotnet: true
  40. haskell: true
  41. large-packages: true
  42. docker-images: false
  43. swap-storage: true
  44. - name: Set up QEMU
  45. uses: docker/setup-qemu-action@v3
  46. - name: Set up Docker Buildx
  47. id: buildx
  48. uses: docker/setup-buildx-action@v3
  49. - name: Login to ghcr
  50. uses: docker/login-action@v1
  51. with:
  52. registry: ghcr.io
  53. username: ${{ github.repository_owner }}
  54. password: ${{ secrets.GITHUB_TOKEN }}
  55. - name: Build and push ${{ matrix.image }}
  56. if: "!github.event.pull_request.head.repo.fork"
  57. run: |
  58. ./containers/build.sh ${{ matrix.image }} ${{ github.repository_owner }} --push
  59. - name: Build ${{ matrix.image }}
  60. if: "github.event.pull_request.head.repo.fork"
  61. run: |
  62. ./containers/build.sh ${{ matrix.image }} ${{ github.repository_owner }}
  63. docker_build_success:
  64. name: Docker Build Success
  65. runs-on: ubuntu-latest
  66. needs: ghcr_build_and_push
  67. steps:
  68. - run: echo Done!