Is it right to keep our faith secret or go against our convictions (taking vaccines made from the cells of aborted children, for example) if not doing so would put the lives of others, especially Christians, at risk? Or is it better to publicly profess our faith and accept the consequences? Church history suggests the former, but the Bible suggests the latter. The question arose when I watched the synod convention and the feed was cut off when the Chinese representatives took the floor; a friend of mine remarked that it would be "more Christian" to allow their identities to be revealed and let the Chinese government act against them, as "they would be going to heaven anyway." I argued that doing so would be reckless and a sin against the Fifth Commandment.
Like you, I would not categorize the scenario you referenced as one in which individuals kept their faith secret. There was a public confession of faith in a very large setting, but there was also a course of action that recognized and addressed their dangerous situation.
When the Lord sent out his disciples, he explained the dangers that awaited them, and he also instructed them, among other things, to be shrewd in their actions (Matthew 10:16).
Certainly, God’s will is that we display our faith in everyday life (Matthew 5:13-16). When Christians find themselves in hostile situations, they will prayerfully determine how they can best do that—taking into account any consequences that might result in their own lives and the lives (and ministries) of others who might be miles away from them.
What we do not want to do is disown our Lord (Matthew 10:33) or sin against our conscience (Romans 14:23).