JohnP is correct in his answer about the order of events, but here's why. You're missing the important phrasing in the PHB entry.
If you are hidden—both unseen and unheard—when you make an attack, you give away your location when the attack hits or misses.
Not When you take the Attack Action or when the attack is otherwise made. The attack has to be resolved as a hit or miss first, and any attack that's resolved as a hit immediately does it's damage first before anything can react to being attacked.
So the act of MAKING the attack isn't what gives away the Goblins position. It's the act of said attack coming into proximity of the Goblin's target, and either hitting or missing said target that gives away the Goblins location. Allow me to add some lose RP embellishment and Environment to the scenario
On his turn, player readies an action to throw javelin when he sees goblin.
(Goblin vanishes in a field of trees, from there he could go/be anywhere when he shows up again and the Player want's to be ready for when it does.)
Goblin, on his turn, uses short bow to shoot PC, goblin rolls attack.
(Goblin sees an opportunity to attack and looses an arrow at the target from his hiding spot, but is still for intents and purposes hidden to the target.)
Goblin misses. (Arrow zooms past targets face and reveals the firing position of the goblin.)
- Player takes his readied reaction and throws Javelin at now revealed Goblin. (I'd be angry too if an arrow nearly hit me.)
OR
- Goblin hits AND rolls damage. (Arrow embeds itself into the targets leg, definitely revealing the firing position of the goblin.)
- Player takes his readied reaction and throws the Javelin at now revealed Goblin (If he's still alive after taking that arrow to the knee, a great war story for sure!)
There are no Interrupt abilities in D&D 5E as there were in 4E (I think?), so to answer the question; No, there are no actions or reactions that I'm aware of without taking Feats that a player can do that will rob or come between an enemy dealing damage after making an attack, or before it can make said attack. Everything in the book is worded carefully to avoid that when it comes to stealth and other situations.
Your Turn
On your turn, you can move and perform an action. The ready action is, as you point out, an action like any other. This means that on your turn you can move and take the ready action.
The Ready Action
The ready action allows you to react to a specific, "perceivable circumstance."
To do so, you can take the Ready action on your turn so that you can act later in the round using your reaction.
When the trigger occurs, you can either take your reaction right after the trigger finishes or ignore the trigger.
Remember that "[a] reaction is an instant response to a trigger of some kind, which can occur on your turn or on someone else's," (Reactions), meaning it happens immediately after the trigger occurs.
Your Questions
However can you move on the same turn that you ready an action?
Yes, you can. It is an action just like any other, and is taken on your turn.
Secondly when the trigger goes off do you have to wait for your turn or do you in effect get a bonus turn?
It's a reaction, and happens immediately. It's not another turn, nor do you have to wait. It happens when the trigger, well, triggers it. Reactions can—and almost always do—occur on someone else's turn.
Caveats
A few notes on the ready action.
- It takes up your reaction, so you can't perform the readied action and an opportunity attack in the same combat round
- The readied action happens when the trigger occurs, but any movement has to be done on your turn—unless your reaction is to move. It does not move your turn in the initiative order
- Spells used for a readied action gives that spell a concentration requirement, and thus doesn't work if you already are concentrating on a spell (or you could choose to stop concentrating on it)
Best Answer
You would be able to move before the goblin could take the Attack action
For my answer, I'm going to assume this particular goblin lost its shortbow and can only make melee attacks. Unless the goblin is only 5 feet away when it starts to move towards you, and you have readied movement under the trigger:
you should be able to use your readied movement to run away from the goblin once it has moved at least 5 feet. It does not need to complete all of its movement before you can use your readied movement.
But if it can make an opportunity attack, that still happens
However, if you use the readied trigger:
then the goblin would be stood next to you before you would be able to act, since according to this answer to a different question, a readied action does not interrupt its trigger but happens afterwards. This is also mentioned on PHB p. 193 (or in the corresponding part of the basic rules), under the description of the "Ready" action (emphasis mine, or rather, enkryptor's):
Therefore, the goblin would be able to make an opportunity attack against you as you run away.
Also, if the goblin is only 5 feet away, then even if your trigger was to run away when the goblin moved towards you rather than stood next to you, it would have already moved 5 feet and would now be stood next to you, since readied actions don't interrupt their triggers. You can still run away before it makes its Attack, but it would still get an opportunity attack against you, which is much the same outcome you were trying to avoid.
Caveats
As pointed out by Slagmoth in comments, if you chose only to move, say, 10 feet rather than using your whole movement, then depending on how far away the goblin was, it may still potentially catch up with you and make an Attack action against you.
Even if you did use all your movement, it may also take the Dash action to run next to you (assuming you were within 60 feet of it, even after you moved away), ready to hit you on its next turn (or with an opportunity attack if you chose to move away again without disengaging, although you would have already used up your reaction this turn so that would be on your next turn, allowing you to adjust your tactics accordingly).
NB: By "only 5 feet away", I mean "in terms of a grid, there is one unoccupied square between you and the goblin" (just in case there's any confusion about what I meant).