deploy-docker.yml 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. name: Release Docker Image
  2. on:
  3. push:
  4. tags: ['v*']
  5. jobs:
  6. build:
  7. runs-on: ubuntu-latest
  8. permissions:
  9. packages: write
  10. contents: write
  11. steps:
  12. - name: Checkout code
  13. uses: actions/checkout@v4
  14. - name: Set up QEMU
  15. uses: docker/setup-qemu-action@v3
  16. - name: Set up Docker Buildx
  17. uses: docker/setup-buildx-action@v3
  18. - name: Login to GitHub Container Registry
  19. run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
  20. - name: Log in to Docker Hub
  21. uses: docker/login-action@v3
  22. with:
  23. username: ${{ secrets.DOCKERHUB_USERNAME }}
  24. password: ${{ secrets.DOCKERHUB_TOKEN }}
  25. - name: Build and push Docker image
  26. uses: docker/build-push-action@v5
  27. with:
  28. context: .
  29. file: ./Dockerfile
  30. platforms: linux/amd64,linux/arm64
  31. push: true
  32. tags: ghcr.io/${{ github.repository }}:${{ github.ref_name }},ghcr.io/${{ github.repository }}:latest,jianboy/${{ github.repository }}:${{ github.ref_name }}
  33. - name: Create GitHub Release
  34. uses: softprops/action-gh-release@v2
  35. - name: Notify team on failure
  36. if: ${{ failure() }}
  37. uses: fjogeleit/http-request-action@v1
  38. with:
  39. url: ${{ secrets.BUILD_NOTIFICATION_URL }}
  40. method: 'POST'
  41. customHeaders: '{"Content-Type": "application/json"}'
  42. data: '{"msg_type": "text","content": {"text": "HeyForm docker image build failed"}}'