The answer is yes, it is legal to publish songs made in Garageband. Apple provides the loops and samples royalty-free.