@@ -17,54 +17,56 @@ slugify() {
17
17
echo " $1 " | iconv -c -t ascii//TRANSLIT | sed -E ' s/[~^]+/-/g' | sed -E ' s/[^a-zA-Z0-9]+/-/g' | sed -E ' s/^-+|-+$/-/g' | tr A-Z a-z
18
18
}
19
19
20
- git_branch=$( git branch --show-current)
21
- echo " Current git branch is '${git_branch} '."
20
+ deploy () {
21
+ git_branch=$( git branch --show-current)
22
+ echo " Current git branch is '${git_branch} '."
22
23
23
- git config user.name github-actions
24
- git config user.email
[email protected]
24
+ git config user.name github-actions
25
+ git config user.email
[email protected]
25
26
26
- git checkout gh-pages
27
- git pull origin gh-pages
27
+ git checkout gh-pages
28
+ git pull origin gh-pages
28
29
29
- if [ " $git_branch " == " $main_git_branch " ]; then
30
- site_dest=" ${gh_pages_root} "
30
+ if [ " $git_branch " == " $main_git_branch " ]; then
31
+ site_dest=" ${gh_pages_root} "
31
32
32
- # Create temporary backup for other branches content.
33
- mv " ${gh_pages_root} /branches" .
33
+ # Create temporary backup for other branches content.
34
+ mv " ${gh_pages_root} /branches" .
34
35
35
- # Replace site files.
36
- rm -rf " ${site_dest} "
37
- mkdir -p " ${site_dest} "
38
- cp -a -v ${site_src} /* ${site_dest} /
36
+ # Replace site files.
37
+ rm -rf " ${site_dest} "
38
+ mkdir -p " ${site_dest} "
39
+ cp -a -v ${site_src} /* ${site_dest} /
39
40
40
- # Restore temporary backup for other branches content.
41
- mv ./branches " ${gh_pages_root} /"
42
- else
43
- site_dest=" ${gh_pages_root} /branches/$( slugify ${git_branch} ) "
41
+ # Restore temporary backup for other branches content.
42
+ mv ./branches " ${gh_pages_root} /"
43
+ else
44
+ site_dest=" ${gh_pages_root} /branches/$( slugify ${git_branch} ) "
44
45
45
- # Replace site files.
46
- rm -rf " ${site_dest} "
47
- mkdir -p " ${site_dest} "
48
- cp -a -v ${site_src} /* ${site_dest} /
49
- fi
46
+ # Replace site files.
47
+ rm -rf " ${site_dest} "
48
+ mkdir -p " ${site_dest} "
49
+ cp -a -v ${site_src} /* ${site_dest} /
50
+ fi
50
51
51
- echo " Updating gh-pages branch."
52
- git add --all
53
- git commit --allow-empty -m " [$( date ' +%F %T %Z' ) ] Updated site for the '${git_branch} ' branch [ci skip]"
54
- git push --force origin gh-pages
55
- echo " Deployment finished."
52
+ echo " Updating gh-pages branch."
53
+ git add --all
54
+ git commit --allow-empty -m " [$( date ' +%F %T %Z' ) ] Updated site for the '${git_branch} ' branch [ci skip]"
55
+ git push --force origin gh-pages
56
+ echo " Deployment finished."
57
+ }
56
58
57
- github_project_url=$( git remote get-url origin)
58
- if [[
$github_project_url == [email protected] :
* ]]
; then
59
- github_repo=
$( echo ${github_project_url# " [email protected] :" } | sed ' s/\.git$//g' )
60
- elif [[ $github_project_url == https://github.com/* ]]; then
61
- github_repo=$( echo ${github_project_url# " https://github.com/" } | sed ' s/\.git$//g' | sed ' s/^\/\///g' )
62
- fi
59
+ update_deployments_list () {
60
+ github_project_url=$( git remote get-url origin)
61
+ if [[
$github_project_url == [email protected] :
* ]]
; then
62
+ github_repo=
$( echo ${github_project_url# " [email protected] :" } | sed ' s/\.git$//g' )
63
+ elif [[ $github_project_url == https://github.com/* ]]; then
64
+ github_repo=$( echo ${github_project_url# " https://github.com/" } | sed ' s/\.git$//g' | sed ' s/^\/\///g' )
65
+ fi
63
66
64
- github_repo_owner=$( echo " ${github_repo} " | sed ' s/\/.*$//g' )
65
- github_repo_name=$( echo " ${github_repo} " | sed ' s/^.*\///g' )
67
+ github_repo_owner=$( echo " ${github_repo} " | sed ' s/\/.*$//g' )
68
+ github_repo_name=$( echo " ${github_repo} " | sed ' s/^.*\///g' )
66
69
67
- update_deployments_list () {
68
70
deployments_list=" DEPLOYMENTS.md"
69
71
echo " Updating ${deployments_list} "
70
72
rm $deployments_list
@@ -92,4 +94,5 @@ update_deployments_list() {
92
94
git push --force origin gh-pages
93
95
}
94
96
97
+ deploy
95
98
update_deployments_list
0 commit comments