In the novel I'm reading there's the phrase "the gig is up," said to a villain who has just been caught. The form with which I'm familiar is "the jig is up." A gig as in a jazz performance? A jig that's a form or template for making an object? What is/are the origins of the phrase?
The OED find the etymology of the word "jig" in its various meanings to be uncertain but traces the meaning of practical joke back to 1590. So when someone says "the jig is up," he means that he's no longer fooled by the pretense. The expression "the game is over" means the same thing: the trickster has been caught out in playing the trick.
I believe the origin is in the dance, as in "dancing a jig."
"The jig (Irish: port) is a form of lively folk dance in compound meter, as well as the accompanying dance tune. It developed in 16th-century England, and was quickly adopted on the Continent where it eventually became the final movement of the mature Baroque dance suite (the French gigue; Italian and Spanish giga)" -- https://en.wikipedia.org/wiki/Jig
Thus it could be that the best meaning of "the jig is up" is "the dance is over" --which seems to fit the OED citation: 1777 Maryland Jrnl. 17 June Mr. John Miller came in and said, ‘The jig is over with us.’
Other speculations relating "the jig" to a trick or a game, would have a parallel in the word "caper," which is both a slang term for a trick, game, or crime, and a dance or element of a dance.
Last but not least, the alternative pronunciation "gig" with a hard "g" has more than slight resemblance the French dance "gigue" and the Spanish and Italian "giga." In French, Spanish, and Italian the "g" may well be soft, in which case use of the hard "g" would be incorrect.