Jesus is trying to get beyond frivolous oaths which were common and was calling for simple and pure honesty.
Hebrews refers specifically to God and indicates His commitment/covenant.
Does the Bible sanction or forbid oaths? In the Old Testament they are not commanded, but permitted. Numbers 30 explains when they can be annulled.
God Himself made an oath as recorded in Hebrews 13:4.
In Matthews 5:34, New Testament believers are told not to swear by anything but to just say yes and no. The explanation given is that we are powerless to change our hair color. But surely God is not similarly powerless, so if He wants to swear something, He is perfectly able to carry it out and nothing can come up to stop Him.
So OT permits swearing (doesn't command it) and sets limits on it. The uplifted NT law abolishes it altogether on the grounds that we are powerless to guarantee the outcome. But God is not powerless, so He can swear as He likes.