Donnelly joined the Gills in the summer of 2015 on a two-year deal following his release from Premier League side Swansea City.
The Northern Irish striker began his career at Cliftonville before joining the Swans in 2012.
He appeared in Europa League ties for the Welsh club but, with first-team chances limited, he served loan spells at Coventry City (January to May 2014) and Tranmere Rovers (January to May 2015). The latter proved a success, as he scored five goals in his 20 appearances for the Wirral club.
Donnelly made his full league debut for the Gills in the 2-1 victory over Bradford City in August 2015, and went on to score 10 times during the season - many of which, including his deft 25-yard chip against Fleetwood Town, his last-minute curled effort away to Crewe Alexandra and his technically-brilliant volley against Doncaster Rovers, quickly went down as fan favourites.