All perfect praise be to Allah, The Lord of the Worlds. I testify that there is none worthy of worship except Allah and that Muhammad is His slave and Messenger.
What you have done is forbidden and is not permissible. Therefore, you must repent to Allah from this sin and also repent from the sin that you have made an oath to abandon.
However, you do not become a disbeliever by this because your intention is not Kufr (disbelief), but rather to abstain from sin by conditioning Kufr on committing it.
So, repent to Allah from all your sins and perform as much good deeds as possible, and do not do such a thing again.
Allah knows best.