-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
From dynamo/dynamo
- Loading branch information
Showing
1 changed file
with
8 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,14 @@ | ||
# Run with mix run release_docs.exs | ||
|
||
# Uncommited changes will not be included! | ||
|
||
# Files that will be included in addition to the | ||
# ex_doc generated files | ||
additional_files = [ | ||
"README.html" | ||
] | ||
|
||
System.cmd "git stash -u" | ||
System.cmd "git clone --branch gh-pages `git config --get remote.origin.url` docs" | ||
|
||
Mix.Task.run "docs" | ||
files = Path.wildcard("docs/**") |> Enum.map(&Path.relative_to(&1, "docs")) | ||
files = files ++ additional_files | ||
# Enum.each(additional_files, &File.cp!(&1, Path.join("docs", &1))) | ||
|
||
IO.puts System.cmd "git checkout gh-pages" | ||
File.cd! "docs", fn -> | ||
System.cmd "git add -A ." | ||
System.cmd "git commit -m \"Updated docs\"" | ||
System.cmd "git push origin gh-pages" | ||
end | ||
|
||
System.cmd "git reset" | ||
|
||
old_files = System.cmd("git ls-files") |> String.split("\n") | ||
old_files = old_files -- additional_files | ||
IO.puts System.cmd "git rm " <> Enum.join(old_files, " ") | ||
|
||
File.cp_r "docs/.", "./" | ||
File.rm_rf! "docs" | ||
|
||
IO.puts System.cmd "git add " <> Enum.join(files, " ") | ||
IO.puts System.cmd "git commit -m \"Update docs\"" | ||
IO.puts System.cmd "git push" | ||
|
||
Enum.each(files, &File.rm_rf!/1) | ||
IO.puts System.cmd "git checkout master --force" | ||
System.cmd "git stash pop" | ||
IO.puts IO.ANSI.escape("%{green}Updated docs pushed to origin/gh-pages") |