All public employee pay should be put online, if they don't like it, they are free to work in the private sector.
All federal public employee pay is already online. General Schedule employees are all in pay grades with ranges, which are public record. Within pay grade ranges there are "steps", which are a function of experience (really seniority). There are also geographic differentials, and these are public too.
Senior managers in the federal government are in the Senior Executive Service (SES), which has a fixed pay range, and it is very low compared to jobs with similar responsibilities in the private sector. Even the pay for presidential appointees is online, like Anthony Fauci, who was the highest paid member of the federal government. (At ~$435K/yr, it is not impressive at all by private sector standards.) Federal employees can get modest bonuses, and these aren't a matter of public record, but in general if you know an employee's grade you know their compensation +/- perhaps 20%.
All of this information is on the opm.gov website.
To attract specialty employees that that don't fit into the GS grades at all (top 2023 GS15 Step 10 pay is $152,771 before a geographic differential and not including bonuses), there are workarounds, like what the military does for doctors and dentists with special benefits. The national labs, for example, are managed by private companies, not the government. (Sandia National Labs, for example, is managed by Lockheed Martin.) So what they pay, while generally public, often substantially exceeds the GS and SES ranges. There are probably numerous other examples for competitive specialties.
The feds can also hire contractors, which are not bound by pay ranges.
If you're talking about state and local governments, every one is different, though most score every job, and job have grades with pay ranges.