Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

release.yml 4.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. name: release
  2. on:
  3. schedule:
  4. - cron: '0 13 * * *' # This schedule runs every 13:00:00Z(21:00:00+08:00)
  5. # The "create tags" trigger is specifically focused on the creation of new tags, while the "push tags" trigger is activated when tags are pushed, including both new tag creations and updates to existing tags.
  6. create:
  7. tags:
  8. - "v*.*.*" # normal release
  9. - "nightly" # the only one mutable tag
  10. # https://docs.github.com/en/actions/using-jobs/using-concurrency
  11. concurrency:
  12. group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
  13. cancel-in-progress: true
  14. jobs:
  15. release:
  16. runs-on: [ "self-hosted", "overseas" ]
  17. steps:
  18. - name: Ensure workspace ownership
  19. run: echo "chown -R $USER $GITHUB_WORKSPACE" && sudo chown -R $USER $GITHUB_WORKSPACE
  20. # https://github.com/actions/checkout/blob/v3/README.md
  21. - name: Check out code
  22. uses: actions/checkout@v4
  23. with:
  24. token: ${{ secrets.MY_GITHUB_TOKEN }} # Use the secret as an environment variable
  25. fetch-depth: 0
  26. fetch-tags: true
  27. - name: Prepare release body
  28. run: |
  29. if [[ $GITHUB_EVENT_NAME == 'create' ]]; then
  30. RELEASE_TAG=${GITHUB_REF#refs/tags/}
  31. if [[ $RELEASE_TAG == 'nightly' ]]; then
  32. PRERELEASE=true
  33. else
  34. PRERELEASE=false
  35. fi
  36. echo "Workflow triggered by create tag: $RELEASE_TAG"
  37. else
  38. RELEASE_TAG=nightly
  39. PRERELEASE=true
  40. echo "Workflow triggered by schedule"
  41. fi
  42. echo "RELEASE_TAG=$RELEASE_TAG" >> $GITHUB_ENV
  43. echo "PRERELEASE=$PRERELEASE" >> $GITHUB_ENV
  44. RELEASE_DATETIME=$(date --rfc-3339=seconds)
  45. echo Release $RELEASE_TAG created from $GITHUB_SHA at $RELEASE_DATETIME > release_body.md
  46. - name: Move the existing mutable tag
  47. # https://github.com/softprops/action-gh-release/issues/171
  48. run: |
  49. git fetch --tags
  50. if [[ $GITHUB_EVENT_NAME == 'schedule' ]]; then
  51. # Determine if a given tag exists and matches a specific Git commit.
  52. # actions/checkout@v4 fetch-tags doesn't work when triggered by schedule
  53. if [ "$(git rev-parse -q --verify "refs/tags/$RELEASE_TAG")" = "$GITHUB_SHA" ]; then
  54. echo "mutable tag $RELEASE_TAG exists and matches $GITHUB_SHA"
  55. else
  56. git tag -f $RELEASE_TAG $GITHUB_SHA
  57. git push -f origin $RELEASE_TAG:refs/tags/$RELEASE_TAG
  58. echo "created/moved mutable tag $RELEASE_TAG to $GITHUB_SHA"
  59. fi
  60. fi
  61. - name: Create or overwrite a release
  62. # https://github.com/actions/upload-release-asset has been replaced by https://github.com/softprops/action-gh-release
  63. uses: softprops/action-gh-release@v2
  64. with:
  65. token: ${{ secrets.MY_GITHUB_TOKEN }} # Use the secret as an environment variable
  66. prerelease: ${{ env.PRERELEASE }}
  67. tag_name: ${{ env.RELEASE_TAG }}
  68. # The body field does not support environment variable substitution directly.
  69. body_path: release_body.md
  70. - name: Set up QEMU
  71. uses: docker/setup-qemu-action@v3
  72. - name: Set up Docker Buildx
  73. uses: docker/setup-buildx-action@v3
  74. # https://github.com/marketplace/actions/docker-login
  75. - name: Login to Docker Hub
  76. uses: docker/login-action@v3
  77. with:
  78. username: infiniflow
  79. password: ${{ secrets.DOCKERHUB_TOKEN }}
  80. # https://github.com/marketplace/actions/build-and-push-docker-images
  81. - name: Build and push full image
  82. uses: docker/build-push-action@v6
  83. with:
  84. context: .
  85. push: true
  86. tags: infiniflow/ragflow:${{ env.RELEASE_TAG }}
  87. file: Dockerfile
  88. platforms: linux/amd64
  89. # https://github.com/marketplace/actions/build-and-push-docker-images
  90. - name: Build and push slim image
  91. uses: docker/build-push-action@v6
  92. with:
  93. context: .
  94. push: true
  95. tags: infiniflow/ragflow:${{ env.RELEASE_TAG }}-slim
  96. file: Dockerfile
  97. build-args: LIGHTEN=1
  98. platforms: linux/amd64
  99. - name: Build ragflow-sdk
  100. if: startsWith(github.ref, 'refs/tags/v')
  101. run: |
  102. cd sdk/python && \
  103. poetry build
  104. - name: Publish package distributions to PyPI
  105. if: startsWith(github.ref, 'refs/tags/v')
  106. uses: pypa/gh-action-pypi-publish@release/v1
  107. with:
  108. packages-dir: sdk/python/dist/
  109. password: ${{ secrets.PYPI_API_TOKEN }}
  110. verbose: true