publish-workflow.yaml 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. name: Publish Docker image
  2. on:
  3. push:
  4. tags:
  5. - '**'
  6. jobs:
  7. openapi:
  8. runs-on: ubuntu-latest
  9. steps:
  10. - uses: actions/checkout@v4
  11. - name: Set up Python 3.13
  12. uses: actions/setup-python@v4
  13. with:
  14. python-version: "3.13"
  15. cache: 'pip'
  16. - name: Install requirements
  17. run: |
  18. pip install fastapi uvicorn python-multipart
  19. pip install -r requirements-min.txt
  20. - name: Generate openapi.json
  21. run: |
  22. python -m etc.tool.openapi
  23. - uses: actions/upload-artifact@v4
  24. with:
  25. name: openapi
  26. path: openapi.json
  27. publish:
  28. runs-on: ubuntu-latest
  29. steps:
  30. - name: Checkout repository
  31. uses: actions/checkout@v4
  32. - name: Set up QEMU
  33. uses: docker/setup-qemu-action@v3
  34. - name: Set up Docker Buildx
  35. uses: docker/setup-buildx-action@v3
  36. - name: Get metadata for Docker
  37. id: metadata
  38. uses: docker/metadata-action@v5
  39. with:
  40. images: |
  41. hlohaus789/g4f
  42. ghcr.io/${{ github.repository }}
  43. - name: Log in to Docker Hub
  44. uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
  45. with:
  46. username: ${{ secrets.DOCKER_USERNAME }}
  47. password: ${{ secrets.DOCKER_PASSWORD }}
  48. - name: Login to GitHub Container Registry
  49. uses: docker/login-action@v3
  50. with:
  51. registry: ghcr.io
  52. username: ${{ github.repository_owner }}
  53. password: ${{ secrets.GHCR_PAT }}
  54. - name: Build and push armv7 image
  55. uses: docker/build-push-action@v5
  56. with:
  57. context: .
  58. file: docker/Dockerfile-armv7
  59. platforms: linux/arm/v7
  60. push: true
  61. tags: |
  62. hlohaus789/g4f:latest-armv7
  63. hlohaus789/g4f:${{ github.ref_name }}-armv7
  64. labels: ${{ steps.metadata.outputs.labels }}
  65. build-args: |
  66. G4F_VERSION=${{ github.ref_name }}
  67. - name: Build and push small images
  68. uses: docker/build-push-action@v5
  69. with:
  70. context: .
  71. file: docker/Dockerfile-slim
  72. platforms: linux/amd64,linux/arm64
  73. push: true
  74. tags: |
  75. hlohaus789/g4f:latest-slim
  76. hlohaus789/g4f:${{ github.ref_name }}-slim
  77. labels: ${{ steps.metadata.outputs.labels }}
  78. build-args: |
  79. G4F_VERSION=${{ github.ref_name }}
  80. - name: Build and push big images
  81. uses: docker/build-push-action@v5
  82. with:
  83. context: .
  84. file: docker/Dockerfile
  85. platforms: linux/amd64,linux/arm64
  86. push: true
  87. tags: ${{ steps.metadata.outputs.tags }}
  88. labels: ${{ steps.metadata.outputs.labels }}
  89. build-args: |
  90. G4F_VERSION=${{ github.ref_name }}