Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

deploy-image.yml 1.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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. runs-on: ubuntu-latest
  19. permissions:
  20. contents: read
  21. packages: write
  22. steps:
  23. - name: Checkout repository
  24. uses: actions/checkout@v3
  25. - name: Login to Docker Hub
  26. uses: docker/login-action@v2
  27. with:
  28. username: ${{ secrets.DOCKERHUB_USERNAME }}
  29. password: ${{ secrets.DOCKERHUB_TOKEN }}
  30. - name: Log in to the Container registry
  31. uses: docker/login-action@v2
  32. with:
  33. registry: ${{ env.REGISTRY }}
  34. username: ${{ github.actor }}
  35. password: ${{ secrets.GITHUB_TOKEN }}
  36. - name: Extract metadata (tags, labels) for Docker
  37. id: meta
  38. uses: docker/metadata-action@v4
  39. with:
  40. images: |
  41. ${{ env.IMAGE_NAME }}
  42. ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
  43. - name: Build and push Docker image
  44. uses: docker/build-push-action@v3
  45. with:
  46. context: .
  47. push: true
  48. file: ./docker/Dockerfile.latest
  49. tags: ${{ steps.meta.outputs.tags }}
  50. labels: ${{ steps.meta.outputs.labels }}
  51. - uses: actions/delete-package-versions@v4
  52. with:
  53. package-name: 'chatgpt-on-wechat'
  54. package-type: 'container'
  55. min-versions-to-keep: 10
  56. delete-only-untagged-versions: 'true'
  57. token: ${{ secrets.GITHUB_TOKEN }}