The rapid development of microgrids (MGs) with various prosumers promotes the accommodation of renewable distributed generation (RDG) and provides platforms for local energy sharing among prosumers. However, the operational uncertainties pose enormous challenges to the day-ahead bidding of MGs in the wholesale electricity market and there is an urgent need for a local market to facilitate the local energy sharing. Thus, this paper proposes a risk-averse day-ahead bidding strategy for MGs with full consideration of the multiple uncertainties originating from the wholesale electricity market, RDG and loads. Based on the transactive energy (TE) sharing concept, the local market is formulated as a Stackelberg game (SG) to effectively capture the strategic interaction among the MG and prosumers, where a distributed iterative algorithm with a bisection approach that only requires exchanging TE-related information is adopted to achieve the SG equilibrium without compromising privacy concerns. To handle the uncertainties of RDG and loads, the power balances are formulated as chance constraints and a data-driven quantile forecasting method is developed for achieving the computational tractability of chance constraints without any prior knowledge or probability distribution assumptions. Furthermore, a risk criterion of the conditional value-at-risk is incorporated in the day-ahead bidding model of MGs for risk aversion towards uncertainties of the wholesale electricity market. The effectiveness of the proposed solution is extensively demonstrated through numerical simulation.