Can anyone tell me what to do to publish if I mined a block
Let's assume that you are solo-mining.
If you are a miner you need to run a Bitcoin Full-Node for example Bitcoin Core. If you do this you are a full part of the Bitcoin network.
If you mine a block, you do the following steps:
- Putting transaction together and verify them
- Doing the Proof-of-Work (Calculating the nounce until the first characters are zeros).
- Adding stuff like coinbase and timestamps
- Profit from the reward and transaction fees
If this is done you broadcast the block to all nodes in the network the same way as broadcast a transaction. This means that all nodes are receiving this block. They are also checking it like if your block matches the difficulty and if the transaction are valid. Then they are adding it to their own local copy of the blockchain.
The nodes are broadcasting the blocks and transactions under each other. That's how peer to peer work. You should take a look at this