tools/plugins required:
iOS/macOS Shortcuts App, Buttons, Advanced URI, Shortcut Launcher
Most of the heavy lifting is done with a shortcut I build. Within the shortcut, you get the contents of the file in which you store the tasks, filters the done tasks with regex, optionally remove indentation tags ahead of tasks and trailing tags, execute find and replace with the help of Advanced URI plugin, and finally append the filtered tasks to a file at its bottom that stores your archived tasks.
Then to make it smoother to activate the shortcut, I configured an Obsidian command using Shortcut Launcher plugin which was built by MacStories, and finally, I made a button(Buttons plugin) to run the command and the underlying shortcut.
You can find the shortcut at this link:
Archive Done Tasks
The code block for button.
name Archive Done Tasks
type command
action Shortcut Launcher: Archive Done Tasks
It is very easy to assemble with the help of a button maker command that comes along with the Buttons plugin.
I hope you like it.
Preview: