1- name : ' Build and Deploy Documentation Site'
2- description : ' Convert Markdown documentation to a BCC documentation site'
1+ name : " Build and Deploy Documentation Site"
2+ description : " Convert Markdown documentation to a BCC documentation site"
33inputs :
44 title :
5- description : ' Title of the generated website'
5+ description : " Title of the generated website"
66 required : true
77 default : ${{ github.event.repository.name }}
88 description :
9- description : ' Description of the generated website, used for the head meta tag'
9+ description : " Description of the generated website, used for the head meta tag"
1010 required : true
1111 default : ${{ github.event.repository.description }}
1212 docs-dir :
13- description : ' Directory where the docs are located'
13+ description : " Directory where the docs are located"
1414 required : false
15- default : ' docs'
15+ default : " docs"
1616 branch :
1717 description : ' Which branch to use for "Edit this page on GitHub" links'
1818 required : false
19- default : ' main'
19+ default : " main"
2020 base :
21- description : ' The base url for the website'
21+ description : " The base url for the website"
2222 required : false
2323 default : /${{ github.event.repository.name }}/
2424 collapse-sidebar :
25- description : ' Whether to collapse sidebar sections by default'
25+ description : " Whether to collapse sidebar sections by default"
2626 required : false
2727 default : false
2828 auto-register-components :
29- description : ' Whether to automatically register Vue components'
29+ description : " Whether to automatically register Vue components"
3030 required : false
3131 default : false
3232 components-dir :
33- description : ' The directory from where Vue components should automatically be registered'
33+ description : " The directory from where Vue components should automatically be registered"
3434 required : false
35- default : ' src/components'
35+ default : " src/components"
3636 debug-build :
37- description : ' Whether or not to enable debugging for the Vite build'
37+ description : " Whether or not to enable debugging for the Vite build"
3838 required : false
3939 default : false
4040 public :
41- description : ' Whether or not to make the documentation publicly available (only works for private repositories)'
41+ description : " Whether or not to make the documentation publicly available (only works for private repositories)"
4242 required : false
4343 default : false
4444 authentication :
45- description : ' Which provider to use for the login flow when accessing the documentation'
45+ description : " Which provider to use for the login flow when accessing the documentation"
4646 required : false
47- default : ' github'
47+ default : " github"
48+ root :
49+ description : " Whether or not to deploy the site to the root of the custom container (true) or to a subfolder named after the repository (false)"
50+ required : false
51+ default : false
4852runs :
4953 using : " composite"
5054 steps :
@@ -58,14 +62,11 @@ runs:
5862 with :
5963 path : source
6064
61- - name : Copy documentation to VuePress theme
65+ - name : Zip Markdown files
6266 shell : bash
6367 run : |
64- cd source
65- cp -r ./${{ inputs.docs-dir }}/* $GITHUB_WORKSPACE/vuepress/docs/
66- ${{ inputs.auto-register-components }} && mkdir $GITHUB_WORKSPACE/vuepress/docs/.vuepress/auto-register-components/
67- ${{ inputs.auto-register-components }} && cp -r ./${{ inputs.components-dir }}/* $GITHUB_WORKSPACE/vuepress/docs/.vuepress/auto-register-components/
68- true
68+ cd source/${{ inputs.docs-dir }}
69+ zip -r MarkdownDocs.zip . -i '*.md'
6970
7071 - uses : microsoft/variable-substitution@v1
7172 with :
@@ -80,25 +81,39 @@ runs:
8081 collapseSidebarSections : ${{ inputs.collapse-sidebar }}
8182 autoRegisterComponents : ${{ inputs.auto-register-components }}
8283
83- - name : Build VuePress site
84+ - name : Get Token from GitHub
85+ id : token
8486 shell : bash
8587 run : |
86- cd vuepress
87- npm ci && ${{ inputs.debug-build == true && 'DEBUG=*' || '' }} npm run build ${{ inputs.debug-build == true && '-- --debug' || '' }}
88+ curl -s -H "Authorization: bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" "$ACTIONS_ID_TOKEN_REQUEST_URL&audience=https://github.com/bcc-code" | jq -r ".value" | echo -e "token=$(</dev/stdin)\n" >> $GITHUB_OUTPUT
8889
89- - name : Zips built site files
90+ - name : Upload Markdown files to azure storage
9091 shell : bash
9192 run : |
92- cd vuepress/docs/.vuepress/dist
93- zip -r Docs.zip *
94-
95- - name : Get Token from GitHub
96- id : token
93+ curl --request POST \
94+ --header "Authorization: Bearer ${{steps.token.outputs.token}}" \
95+ --form Docs=@source/${{ inputs.docs-dir }}/MarkdownDocs.zip \
96+ "https://developer.bcc.no/UploadMdContainer?aggregateContainer=MdDocs&root=${{inputs.root}}"
97+
98+ - name : Download Markdown files from azure storage
9799 shell : bash
98100 run : |
99- curl -s -H "Authorization: bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" "$ACTIONS_ID_TOKEN_REQUEST_URL&audience=https://github.com/bcc-code" | jq -r ".value" | echo -e "token=$(</dev/stdin)\n" >> $GITHUB_OUTPUT
100-
101- - name : Upload files to azure storage
101+ curl --header "Authorization: Bearer ${{steps.token.outputs.token}}" \
102+ "https://developer.bcc.no/GetDoc?container=MdDocs" \
103+ --output MarkdownDocs.zip
104+ unzip -o MarkdownDocs.zip -d vuepress/docs/
105+
106+ - name : Build VuePress site
107+ shell : bash
108+ run : |
109+ cd vuepress
110+ npm ci && ${{ inputs.debug-build == true && 'DEBUG=*' || '' }} npm run build ${{ inputs.debug-build == true && '-- --debug' || '' }}
111+
112+ - name : Upload VuePress site
102113 shell : bash
103114 run : |
104- curl --request POST --header "Authorization: Bearer ${{steps.token.outputs.token}}" --header 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36' --form Docs=@vuepress/docs/.vuepress/dist/Docs.zip "https://developer.bcc.no/UploadDoc?isPublic=${{inputs.public}}&auth=${{inputs.authentication}}"
115+ cd vuepress
116+ curl --request POST \
117+ --header "Authorization: Bearer ${{steps.token.outputs.token}}" \
118+ --form Docs=@./.vuepress/dist.zip \
119+ "https://developer.bcc.no/UploadDoc?isPublic=${{inputs.public}}&auth=${{inputs.authentication}}&customContainerName=DocumentationSite"
0 commit comments