Action Principle and Dynamic Ensemble Theory for Non-equilibrium Markov Chains