You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

преди 1 година
преди 1 година
преди 1 година
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. # This workflow uses actions that are not certified by GitHub.
  2. # They are provided by a third-party and are governed by
  3. # separate terms of service, privacy policy, and support
  4. # documentation.
  5. # GitHub recommends pinning actions to a commit SHA.
  6. # To get a newer version, you will need to update the SHA.
  7. # You can also reference a tag or branch, but the action may change without warning.
  8. name: Create and publish a Docker image
  9. on:
  10. push:
  11. branches: ['master']
  12. create:
  13. env:
  14. REGISTRY: ghcr.io
  15. IMAGE_NAME: ${{ github.repository }}
  16. jobs:
  17. build-and-push-image:
  18. if: github.repository == 'zhayujie/chatgpt-on-wechat'
  19. runs-on: ubuntu-latest
  20. permissions:
  21. contents: read
  22. packages: write
  23. steps:
  24. - name: Checkout repository
  25. uses: actions/checkout@v3
  26. - name: Login to Docker Hub
  27. uses: docker/login-action@v2
  28. with:
  29. username: ${{ secrets.DOCKERHUB_USERNAME }}
  30. password: ${{ secrets.DOCKERHUB_TOKEN }}
  31. - name: Log in to the Container registry
  32. uses: docker/login-action@v2
  33. with:
  34. registry: ${{ env.REGISTRY }}
  35. username: ${{ github.actor }}
  36. password: ${{ secrets.GITHUB_TOKEN }}
  37. - name: Extract metadata (tags, labels) for Docker
  38. id: meta
  39. uses: docker/metadata-action@v4
  40. with:
  41. images: |
  42. ${{ env.IMAGE_NAME }}
  43. ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
  44. - name: Build and push Docker image
  45. uses: docker/build-push-action@v3
  46. with:
  47. context: .
  48. push: true
  49. file: ./docker/Dockerfile.latest
  50. tags: ${{ steps.meta.outputs.tags }}
  51. labels: ${{ steps.meta.outputs.labels }}
  52. - uses: actions/delete-package-versions@v4
  53. with:
  54. package-name: 'chatgpt-on-wechat'
  55. package-type: 'container'
  56. min-versions-to-keep: 10
  57. delete-only-untagged-versions: 'true'
  58. token: ${{ secrets.GITHUB_TOKEN }}