-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.yml
104 lines (97 loc) · 3.93 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
name: 'Build and Deploy Documentation Site'
description: 'Convert Markdown documentation to a BCC documentation site'
inputs:
title:
description: 'Title of the generated website'
required: true
default: ${{ github.event.repository.name }}
description:
description: 'Description of the generated website, used for the head meta tag'
required: true
default: ${{ github.event.repository.description }}
docs-dir:
description: 'Directory where the docs are located'
required: false
default: 'docs'
branch:
description: 'Which branch to use for "Edit this page on GitHub" links'
required: false
default: 'main'
base:
description: 'The base url for the website'
required: false
default: /${{ github.event.repository.name }}/
collapse-sidebar:
description: 'Whether to collapse sidebar sections by default'
required: false
default: false
auto-register-components:
description: 'Whether to automatically register Vue components'
required: false
default: false
components-dir:
description: 'The directory from where Vue components should automatically be registered'
required: false
default: 'src/components'
debug-build:
description: 'Whether or not to enable debugging for the Vite build'
required: false
default: false
public:
description: 'Whether or not to make the documentation publicly available (only works for private repositories)'
required: false
default: false
authentication:
description: 'Which provider to use for the login flow when accessing the documentation'
required: false
default: 'github'
runs:
using: "composite"
steps:
- name: Check out base repository
uses: actions/checkout@v3
with:
repository: bcc-code/bcc-documentation-base
- name: Check out current repository
uses: actions/checkout@v3
with:
path: source
- name: Copy documentation to VuePress theme
shell: bash
run: |
cd source
cp -r ./${{ inputs.docs-dir }}/* $GITHUB_WORKSPACE/vuepress/docs/
${{ inputs.auto-register-components }} && mkdir $GITHUB_WORKSPACE/vuepress/docs/.vuepress/auto-register-components/
${{ inputs.auto-register-components }} && cp -r ./${{ inputs.components-dir }}/* $GITHUB_WORKSPACE/vuepress/docs/.vuepress/auto-register-components/
true
- uses: microsoft/variable-substitution@v1
with:
files: "vuepress/docs/.vuepress/data.json"
env:
title: ${{ inputs.title }}
description: ${{ inputs.description }}
base: ${{ inputs.base }}
docsRepo: ${{ github.repository }}
docsDir: ${{ inputs.docs-dir }}
docsBranch: ${{ inputs.branch }}
collapseSidebarSections: ${{ inputs.collapse-sidebar }}
autoRegisterComponents: ${{ inputs.auto-register-components }}
- name: Build VuePress site
shell: bash
run: |
cd vuepress
npm ci && ${{ inputs.debug-build == true && 'DEBUG=*' || '' }} npm run build ${{ inputs.debug-build == true && '-- --debug' || '' }}
- name: Zips built site files
shell: bash
run: |
cd vuepress/docs/.vuepress/dist
zip -r Docs.zip *
- name: Get Token from GitHub
id: token
shell: bash
run: |
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
- name: Upload files to azure storage
shell: bash
run: |
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}}"