Generally a bad idea but I've told my bosses I was interviewing twice, and I'm glad I did both times, so there are exceptions.
1) First time was like you, I knew I would get fired (without cause) or laid off, either of which I welcomed. Hated that job for the last 4 of the 5 years I was there, horrible boss/company. After I told them, I got laid off 'due to restructuring' which qualified me for unemployment and allowed me to take time on the job search.
2) Best job I've ever had working for the best boss I've ever had, but unfortunately I had already been planning to move out of state before I started there. The position itself was ok, not great but ok, but after 2 years I was poised to replace my boss when he retired (controller/CFO for the company, he was 68 at the time). I would have changed my life plans of moving if he had been planning on retiring soon, due to it being such a good opportunity and I liked the company/people so much, but he loved his job and was very good at it, so was in no hurry to stop doing it. He was also good friends with the owner so it was almost like playtime for them. I talked to him about my plans of moving and asked him for his timeline and he said 2-4 years most likely. 4 years was too long for me to wait for something that, while likely, was not guaranteed. Shortly after that a friend of mine in California dropped my name to his boss and I got a call. When they asked me to fly out to do an interview, I was honest with my boss about why I needed the time off. He 100% understood, was very appreciative of my honesty, and was excited for me for the opportunity. I got the job and gave 3 weeks notice. I couldn't have left with more goodwill and have an open invitation to come back should I move back to Ohio.
So general rule is stfu about it, but definitely exceptions.