@@ -3,24 +3,46 @@ description: "This action bundles the current gh-page branch with the out folder
33runs :
44 using : " composite"
55 steps :
6- - name : ➕ Create public dir
7- run : mkdir public
8- shell : bash
9- - name : 📥 Get gh-pages tar
10- run : wget https://github.com/dbsystel/cicd-playground/tarball/gh-pages
11- shell : bash
12- - name : 📦 Unpack Tar
13- run : tar -zxvf gh-pages -C public --strip-components 1
14- shell : bash
156 - name : ↔ Extract branch name
167 shell : bash
178 run : echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
189 id : extract_branch
19- - name : 📁 Move ./out folder to public for preview
20- if : ${{ !contains( github.ref, 'main') }}
21- run : mv ./out ./public/${{ steps.extract_branch.outputs.branch }}
10+ - name : ➕ Create temp or public dir
11+ run : |
12+ echo "Create dir for branch: ${{ steps.extract_branch.outputs.branch }}"
13+ if echo ${{ steps.extract_branch.outputs.branch }} | grep -c "main"
14+ then
15+ mkdir temp
16+ echo "Created 'temp' dir"
17+ else
18+ mkdir public
19+ echo "Created 'public' dir"
20+ fi
21+ shell : bash
22+ - name : 📥 Get gh-pages tar
23+ run : wget -q https://github.com/dbsystel/cicd-playground/tarball/gh-pages
24+ shell : bash
25+ - name : 📦 Unpack Tar
26+ run : |
27+ if echo ${{ steps.extract_branch.outputs.branch }} | grep -c "main"
28+ then
29+ tar -zxf gh-pages -C temp --strip-components 1
30+ else
31+ tar -zxf gh-pages -C public --strip-components 1
32+ fi
2233 shell : bash
23- - name : 📁 Move ./out folder to public for main
24- if : ${{ contains( github.ref, 'main') }}
25- run : mv ./out ./public
34+ - name : 📁 Move ./out folder to public
35+ run : |
36+ if echo ${{ steps.extract_branch.outputs.branch }} | grep -c "main"
37+ then
38+ mv ./out ./public
39+ if [ -d ./temp/review ]; then
40+ mv ./temp/review ./public
41+ fi
42+ else
43+ if [ ! -d ./public/review ]; then
44+ mkdir ./public/review
45+ fi
46+ mv ./out ./public/review/${{ steps.extract_branch.outputs.branch }}
47+ fi
2648 shell : bash
0 commit comments