name: Release Docker Image on: push: tags: ['v*'] jobs: build: runs-on: ubuntu-latest permissions: packages: write contents: write steps: - name: Checkout code uses: actions/checkout@v4 - name: Set up QEMU uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - name: Login to GitHub Container Registry run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin - name: Log in to Docker Hub uses: docker/login-action@v3 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - name: Build and push Docker image uses: docker/build-push-action@v5 with: context: . file: ./Dockerfile platforms: linux/amd64,linux/arm64 push: true tags: ghcr.io/${{ github.repository }}:${{ github.ref_name }},ghcr.io/${{ github.repository }}:latest,jianboy/${{ github.repository }}:${{ github.ref_name }} - name: Create GitHub Release uses: softprops/action-gh-release@v2 - name: Notify team on failure if: ${{ failure() }} uses: fjogeleit/http-request-action@v1 with: url: ${{ secrets.BUILD_NOTIFICATION_URL }} method: 'POST' customHeaders: '{"Content-Type": "application/json"}' data: '{"msg_type": "text","content": {"text": "HeyForm docker image build failed"}}'