ghcr_app.yml 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. # Workflow that builds, tests and then pushes the app docker images to the ghcr.io repository
  2. name: Build and Publish App Image
  3. # Always run on "main"
  4. # Always run on tags
  5. # Always run on PRs
  6. # Can also be triggered manually
  7. on:
  8. push:
  9. branches:
  10. - main
  11. tags:
  12. - '*'
  13. pull_request:
  14. workflow_dispatch:
  15. inputs:
  16. reason:
  17. description: 'Reason for manual trigger'
  18. required: true
  19. default: ''
  20. jobs:
  21. # Builds the OpenHands Docker images
  22. ghcr_build:
  23. name: Build App Image
  24. runs-on: ubuntu-latest
  25. permissions:
  26. contents: read
  27. packages: write
  28. steps:
  29. - name: Checkout
  30. uses: actions/checkout@v4
  31. - name: Free Disk Space (Ubuntu)
  32. uses: jlumbroso/free-disk-space@main
  33. with:
  34. # this might remove tools that are actually needed,
  35. # if set to "true" but frees about 6 GB
  36. tool-cache: true
  37. # all of these default to true, but feel free to set to
  38. # "false" if necessary for your workflow
  39. android: true
  40. dotnet: true
  41. haskell: true
  42. large-packages: true
  43. docker-images: false
  44. swap-storage: true
  45. - name: Set up QEMU
  46. uses: docker/setup-qemu-action@v3
  47. - name: Login to GHCR
  48. uses: docker/login-action@v3
  49. with:
  50. registry: ghcr.io
  51. username: ${{ github.repository_owner }}
  52. password: ${{ secrets.GITHUB_TOKEN }}
  53. - name: Set up Docker Buildx
  54. id: buildx
  55. uses: docker/setup-buildx-action@v3
  56. - name: Build and push app image
  57. if: "!github.event.pull_request.head.repo.fork"
  58. run: |
  59. ./containers/build.sh openhands ${{ github.repository_owner }} --push
  60. - name: Build app image
  61. if: "github.event.pull_request.head.repo.fork"
  62. run: |
  63. ./containers/build.sh openhands image ${{ github.repository_owner }}