Fix ARTIFACT env-var being replaced if only one entry is listed.

Also, use WriteEnv.
Merge pull request #191 from fudanchii/deployment

Fix `artifact` env-var being replaced if only one entry is listed.