You have several issues in your code.
1) When you use summarise, your column education.num will be replaced by mean in your dataset as you can see below:
library(dplyr)
mydata %>%
group_by(workclass) %>%
summarise(mean = mean(education.num, na.rm = TRUE))
# A tibble: 9 x 2
workclass mean
<chr> <dbl>
1 ? 9.26
2 Federal-gov 11.0
3 Local-gov 11.0
4 Never-worked 7.43
5 Private 9.88
6 Self-emp-inc 11.1
7 Self-emp-not-inc 10.2
8 State-gov 11.4
9 Without-pay 9.07
2) then, in your ggplot, you are calling an another dataframe new_data and try to reuse education.num instead of mean. You can correct it by doing:
library(dplyr)
library(ggplot2)
mydata %>%
group_by(workclass) %>%
summarise(mean = mean(education.num, na.rm = TRUE)) %>%
ggplot(aes(workclass, mean, fill = workclass)) +
geom_bar(stat = "identity") +
labs(title = "Average Education Num vs workclass",
x = "Workclass",
y = "Average Education Num") +
theme(axis.text.x = element_text(size = 10, angle = 90, hjust = 1),
axis.text = element_text(size = 10),
axis.title = element_text(size = 10),
legend.title = element_text(size = 10))

3) Finally, you are trying to replace filling values by cbPalette, however, you are providing only 8 values whereas you have 9 different classes, so you need to either add a new color and remove ? like that:
library(dplyr)
library(ggplot2)
mydata %>%
group_by(workclass) %>%
summarise(mean = mean(education.num, na.rm = TRUE)) %>%
filter(workclass != "?") %>%
ggplot(aes(workclass, mean, fill = workclass)) +
geom_bar(stat = "identity") +
labs(title = "Average Education Num vs workclass",
x = "Workclass",
y = "Average Education Num") +
theme(axis.text.x = element_text(size = 10, angle = 90, hjust = 1),
axis.text = element_text(size = 10),
axis.title = element_text(size = 10),
legend.title = element_text(size = 10)) +
scale_fill_manual(values = cbPalette)

Does it answer your question ?
summarise.