The Gauss-Bonnet formula gives a topological invariant as an integral over a local density on the given manifold. In particular, when there is a boundary, GB formula has to be supplemented by a boundary term, for example the extrinsic curvature in two dimensional case.
I am wondering if there is an analogous topological invariant for a gauge theory (or principal bundle) on manifolds with boundary, and if so, what is its boundary term. I am particularly interested in the case of the two dimensional base manifold.
Note added: I am from a physics background and pretty new to this kind of subject. It would be especially great if one can also point to physics-oriented reference on this.