Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

72 lignes
2.0KB

  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: Set up QEMU
  27. uses: docker/setup-qemu-action@v1
  28. - name: Set up Docker Buildx
  29. id: buildx
  30. uses: docker/setup-buildx-action@v1
  31. - name: Available platforms
  32. run: echo ${{ steps.buildx.outputs.platforms }}
  33. - name: Log in to the Container registry
  34. uses: docker/login-action@v2
  35. with:
  36. registry: ${{ env.REGISTRY }}
  37. username: ${{ github.actor }}
  38. password: ${{ secrets.GITHUB_TOKEN }}
  39. - name: Extract metadata (tags, labels) for Docker
  40. id: meta
  41. uses: docker/metadata-action@v4
  42. with:
  43. images: |
  44. ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
  45. - name: Build and push Docker image
  46. uses: docker/build-push-action@v3
  47. with:
  48. context: .
  49. push: true
  50. file: ./docker/Dockerfile.latest
  51. platforms: linux/arm64
  52. tags: ${{ steps.meta.outputs.tags }}-arm64
  53. labels: ${{ steps.meta.outputs.labels }}
  54. - uses: actions/delete-package-versions@v4
  55. with:
  56. package-name: 'chatgpt-on-wechat'
  57. package-type: 'container'
  58. min-versions-to-keep: 10
  59. delete-only-untagged-versions: 'true'
  60. token: ${{ secrets.GITHUB_TOKEN }}