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$. For $s\in C^\infty(G,\underline{E})$, we define the $G$ action by, $(g\cdot s)(x)=s(g^{-1}x)$. Take $e\in E$, then $e$ define a $G$-invariant section $s_e$ of $\underline{E}$, that is $s_e(x)=e.$ We define a connection on $\underline{E}$ by $$\nabla_{X_U}s_e=s_{\rho(U)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).$$ To show this argument, we identify $\Omega^\cdot(G,\underline{E})^G$ the left-G-invariant differential form with coefficients in $\underline{E}$, with $\mathrm{Hom}(\Lambda^\cdot(\mathfrak{g}),E)$. Under this identification, The de Rham differential operator $d$ become the differential of the complex $\mathrm{Hom}(\Lambda^\cdot(\mathfrak{g}),E)$. This means $$H^\cdot(\Omega^\cdot(G,\underline{E})^G,d)=H^\cdot(\mathfrak{g},E).$$ It is an exercise (by construct a chain homotopy) to show $$H^\cdot(\Omega^\cdot(G,\underline{E})^G,d)=H^\cdot(\Omega^\cdot(G,\underline{E}),d).$$ The right hand side is definition of the de Rham cohomology.