Some doubts about GnuPG
You cannot encrypt a file with a private key. With RSA, that's not because of any technical obstacle (with other schemes private keys literally are not valid inputs to the encryption function), but because private keys are designated as "private" and using them in an encryption operation compromises the security of that message. To prove you wrote the message, you don't encrypt it with your private key.

What you do do is sign the message. Signatures take a private key; best practices are to use a different keypair for signatures than for encryption (a default GPG "keypair" is really at two keypairs; there's a master keypair that's tied to your identity which is used only for signing, and a different subordinate keypair which is signed with the master keypair and which is used only for encryption). If you use different keys for signing and encryption, there are no issues with compromising your encryption.

Signing with RSA is not "encrypt with the private key." It has a passing resemblance to that (as the primitive used for encryption, the one for signing, the one for decryption, and the one for verification are all the same operation with different inputs and outputs) but it is a conceptually distinct algorithm which is designed not to let someone with the signature recover the message.

An RSA signature is created by creating a preimage-resistant hash of the message, doing various operations (known as padding) to the hash value to increase security, and passing it through the signature primitive (raising it to the power of the private exponent modulo $n$). In the more modern signature padding algorithm (PSS), the hash of the message is itself not recoverable, because it is combined with a random salt and passed through another preimage-resistant hash, and that is part of what's passed to the signature primitive (the other part is the salt, obfuscated using the hash of the hash+salt). In the older system (PKCS 1.5 padding), the hash could be directly recovered, but as it's preimage-resistant that doesn't give much help to an attacker looking for the message. An attacker in either case can test whether a given message was the one sent, but they can't find the message if they don't already have a candidate message.