選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

60 行
1.7KB

  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. release:
  13. types: [published]
  14. env:
  15. REGISTRY: ghcr.io
  16. IMAGE_NAME: ${{ github.repository }}
  17. jobs:
  18. build-and-push-image:
  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: Log in to the Container registry
  27. uses: docker/login-action@v2
  28. with:
  29. registry: ${{ env.REGISTRY }}
  30. username: ${{ github.actor }}
  31. password: ${{ secrets.GITHUB_TOKEN }}
  32. - name: Extract metadata (tags, labels) for Docker
  33. id: meta
  34. uses: docker/metadata-action@v4
  35. with:
  36. images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
  37. - name: Build and push Docker image
  38. uses: docker/build-push-action@v3
  39. with:
  40. context: .
  41. push: true
  42. file: ./docker/Dockerfile.latest
  43. tags: ${{ steps.meta.outputs.tags }}
  44. labels: ${{ steps.meta.outputs.labels }}
  45. - uses: actions/delete-package-versions@v4
  46. with:
  47. package-name: 'chatgpt-on-wechat'
  48. package-type: 'container'
  49. min-versions-to-keep: 10
  50. delete-only-untagged-versions: 'true'
  51. token: ${{ secrets.GITHUB_TOKEN }}