For example the Pentagon Papers were released by Daniel Ellsberg and published by The NY Times. From Wikipedia;
> For his disclosure of the Pentagon Papers, Ellsberg was initially charged with conspiracy, espionage, and theft of government property, but the charges were later dismissed after prosecutors investigating the Watergate scandal discovered that the staff members in the Nixon White House had ordered the so-called White House Plumbers to engage in unlawful efforts to discredit Ellsberg.
An FBI agent, military enlisted or officer, etc. would rightly face charges for doseminating classified materials. There is no carte blanche to break the law because of something you don’t like that your Administration is doing. Sometimes the offense is so egregious that it’s a sacrifice someone is willing to make. In those cases if the court of public opinion is enough on the side of the leaker, there is always pardons or jury nullification to fall back on.
But I do think that it’s still precipitated by an illegal act (the leaking) which can rightly be prosecuted because generally classified material is classified for a reason and it’s not up to each individual that comes across it to decide if they agree or not.
The publisher also has to be careful that they are not soliciting or assisting the leaker in providing the materials lest they become an accomplice. I assume, although I’m not fully up to speed on the case, that this is the angle for charging Assange.