|
1 | 1 | #!/usr/bin/env bash |
2 | 2 |
|
3 | 3 | if [[ $NAME == "true" ]]; then |
4 | | - echo "Erro: Missing NAME variable" |
5 | | - exit 1 |
6 | | -fi |
7 | | - |
8 | | -echo "➕ Create temp or public dir: $NAME" |
9 | | -if [[ $RELEASE == "true" ]]; then |
10 | | - mkdir temp |
11 | | - echo " Created 'temp' dir" |
12 | | -else |
13 | | - mkdir public |
14 | | - echo " Created 'public' dir" |
| 4 | + echo "Erro: Missing NAME variable" |
| 5 | + exit 1 |
15 | 6 | fi |
16 | 7 |
|
| 8 | +echo "➕ Create public dir" |
| 9 | +mkdir public |
17 | 10 |
|
18 | 11 | echo "📥 Get gh-pages tar" |
19 | 12 | curl -L https://github.com/"$OWNER_NAME"/"$REPO_NAME"/tarball/gh-pages --output gh-pages |
20 | 13 |
|
21 | 14 | echo "📦 Unpack Tar" |
22 | | -if [[ $RELEASE == "true" ]]; then |
23 | | - tar -zxf gh-pages -C temp --strip-components 1 |
24 | | -else |
25 | | - tar -zxf gh-pages -C public --strip-components 1 |
26 | | -fi |
| 15 | +tar -zxf gh-pages -C public --strip-components 1 |
27 | 16 |
|
28 | | -echo "📁 Bundle public" |
29 | 17 | if [[ $RELEASE == "true" ]]; then |
30 | | - echo " Move ./out ./public" |
31 | | - mv ./out ./public |
32 | | - cp -R ./public out |
33 | | - if [ -d ./temp/review ]; then |
34 | | - echo " Move ./temp/review ./public" |
35 | | - mv ./temp/review ./public |
36 | | - fi |
37 | | - if [ -d ./temp/version ]; then |
38 | | - echo " Move ./temp/version ./public" |
39 | | - mv ./temp/version ./public |
40 | | - fi |
| 18 | + echo "🔃 Change redirect" |
| 19 | + echo "<meta http-equiv=\"refresh\" content=\"0; URL=https://"$OWNER_NAME".github.io/"$REPO_NAME"/version/"$NAME"\" />" >public/index.html |
41 | 20 | fi |
42 | 21 |
|
| 22 | +echo "👣 Move out dir" |
43 | 23 | if [[ $PRE_RELEASE == "true" || $RELEASE == "true" ]]; then |
44 | | - if [[ ! -d ./public/version ]]; then |
45 | | - echo " Make dir ./public/version" |
46 | | - mkdir ./public/version |
47 | | - fi |
48 | | - if [[ -d ./public/version/"$NAME" ]]; then |
49 | | - echo " Remove dir ./public/version/$NAME" |
50 | | - rm -rf ./public/version/"$NAME" |
51 | | - fi |
52 | | - mv ./out ./public/version/"$NAME" |
| 24 | + if [[ ! -d ./public/version ]]; then |
| 25 | + echo " Make dir ./public/version" |
| 26 | + mkdir ./public/version |
| 27 | + fi |
| 28 | + if [[ -d ./public/version/"$NAME" ]]; then |
| 29 | + echo " Remove dir ./public/version/$NAME" |
| 30 | + rm -rf ./public/version/"$NAME" |
| 31 | + fi |
| 32 | + mv ./out ./public/version/"$NAME" |
53 | 33 | else |
54 | | - if [[ ! -d ./public/review ]]; then |
55 | | - echo " Make dir ./public/review" |
56 | | - mkdir ./public/review |
57 | | - fi |
58 | | - if [[ -d ./public/review/"$NAME" ]]; then |
59 | | - echo " Remove dir ./public/review/$NAME" |
60 | | - rm -rf ./public/review/"$NAME" |
61 | | - fi |
62 | | - mv ./out ./public/review/"$NAME" |
| 34 | + if [[ ! -d ./public/review ]]; then |
| 35 | + echo " Make dir ./public/review" |
| 36 | + mkdir ./public/review |
| 37 | + fi |
| 38 | + if [[ -d ./public/review/"$NAME" ]]; then |
| 39 | + echo " Remove dir ./public/review/$NAME" |
| 40 | + rm -rf ./public/review/"$NAME" |
| 41 | + fi |
| 42 | + mv ./out ./public/review/"$NAME" |
63 | 43 | fi |
0 commit comments