Is it okay to publish my personal notes from a lecture? Would it be considered ethical to publish my own personal notes from class? In addition, is there a change when the class transitions from in session to being complete (at the end of the semester)?

For example when this may be relevant, there are courses where the Professor publishes his slides onto a class portal, but excludes certain material that is only covered in class. This is to incentivize students to show up, rather than only study from the from published slides.
The ethical thing to do, in my opinion, would be to ask the professor's permission.