How to archive all the DONE tasks using a single command

You can bulk archive (or refile/change todo etc) from within the Agenda view.

http://orgmode.org/manual/Agenda-commands.html#Agenda-commands

If you call Org-Agenda from within the buffer you want to archive you can temporarily restrict it to only that buffer and view only todo entries and filter for only DONE

C-c a < t
N r

Where N corresponds to the shortcut for your DONE state (with default states it would be 2)

Then you'd simply need to mark all the desired headlines and bulk archive

m (mark for bulk action)
B a (or B $ for arch->sibling)

Here's a corrected version of madalu's snippet. Note that this version also only operates on the current subtree (change 'tree back to 'file to operate over the entire file).

(defun org-archive-done-tasks ()
  (interactive)
  (org-map-entries
   (lambda ()
     (org-archive-subtree)
     (setq org-map-continue-from (org-element-property :begin (org-element-at-point))))
   "/DONE" 'tree))

You can write a function using org-map-entries:

(defun my-org-archive-done-tasks ()
  (interactive)
  (org-map-entries 'org-archive-subtree "/DONE" 'file))