We assume $G$ is a compact connected Lie group with Lie algebra $\mathfrak{g}$. Let $\rho:\mathfrak{g}\to \mathrm{End}(E)$ is a finite representation.
We denote by $\underline{E}=G\times E$ the trivial bundle over $G$. Take $U\in \mathfrak{g}$, then $U$ define a left-invariant vector field $X_U$ on $G$. Take $e\in E$, then $e$ define a left-invariant section $s_e$ of $\underline{E}$.
We define a connection on $\underline{E}$ by $$\nabla_{X_U}s_e=s_{\rho(X)e}.$$ This is a flat connection. The de Rham cohomology associated to this flat bundle $(\underline{E},\nabla)$ is what you are looking for in comment 2, i.e., $$H^\cdot_{dR}(G,\underline{E})=H^\cdot(\mathfrak{g},E).$$