-
Notifications
You must be signed in to change notification settings - Fork 41
138 lines (114 loc) · 4.31 KB
/
ManageDocs.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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
name: ManageDocs
on:
workflow_call:
inputs:
branch-name:
description: 'Branch to be used as base to create a new one to generate and be published.'
type: string
required: true
delete-created-branch:
description: 'When True deploy-docs branch will be removed at the end of process.'
type: boolean
required: true
run-lint:
description: 'Compile and perform lint tests to ensure there is no issues at given branch name.'
type: boolean
default: true
secrets:
pat:
required: true
uiCompDocs:
required: true
jobs:
check-repo:
runs-on: ubuntu-latest
outputs:
is-real-osui-repo: ${{ steps.check-is-real-osui-repo.outputs.isIt }}
steps:
- name: Check if it's outsystems-ui real repository
id: check-is-real-osui-repo
run: |
echo "isIt=${{ github.event.repository.name == 'outsystems-ui' }}" >> "$GITHUB_OUTPUT"
run-lint:
runs-on: ubuntu-latest
steps:
- name: Checkout into ${{ inputs.branch-name }}
uses: actions/checkout@v4
with:
ref: ${{ inputs.branch-name }}
token: ${{ secrets.pat }}
- name: Install project dependencies
if: ${{ inputs.run-lint == true }}
run: npm install
- name: Run build
if: ${{ inputs.run-lint == true }}
run: npm run build
create-branch:
needs: run-lint
runs-on: ubuntu-latest
steps:
- name: Checkout into ${{ inputs.branch-name }}
uses: actions/checkout@v4
with:
ref: ${{ inputs.branch-name }}
token: ${{ secrets.pat }}
- name: Create new deploy-docs branch based on ${{ inputs.branch-name }}
run: |
git checkout -b deploy-docs
git push -u origin deploy-docs
create-doc:
needs: create-branch
runs-on: ubuntu-latest
steps:
- name: Configure Git with the UiComponentsBot Token
run: |
git config --global user.email "[email protected]"
git config --global user.name "UiComponentsBot"
- name: Checkout into deploy-docs
uses: actions/checkout@v4
with:
ref: deploy-docs
token: ${{ secrets.PAT }}
- name: Install project dependencies
run: npm install
- name: Install graphviz
run: sudo apt install -y graphviz
- name: Generate documentation
run: npm run docs
- name: Perform git commit
uses: ./.github/os-git-actions/manual-commit/
with:
branch: deploy-docs
message: 'Update documentation [skip ci]'
newFiles: true
publish-doc:
needs: [check-repo, create-doc]
runs-on: ubuntu-latest
steps:
- name: Checkout into deploy-docs
uses: actions/checkout@v4
with:
ref: deploy-docs
token: ${{ secrets.pat }}
- name: Push documentation files into github page
if: ${{ needs.check-repo.outputs.is-real-osui-repo == 'true' }}
uses: GuillaumeFalourd/copy-push-files@v1
with:
source_files: docs/*
remote_repository: https://github.com/outsystems-ui-docs/outsystems-ui-docs.github.io
access_token: ${{ secrets.uiCompDocs }}
target_branch: main
commit_message: Deploy documentation.
delete-branch:
needs: publish-doc
runs-on: ubuntu-latest
if: ${{ inputs.delete-created-branch == true }}
steps:
- name: Checkout branch dev
uses: actions/checkout@v4
with:
ref: dev
- name: Delete branch deploy-docs
shell: bash
run: |
git push origin -d deploy-docs