-
Notifications
You must be signed in to change notification settings - Fork 54
207 lines (173 loc) · 7.78 KB
/
create-n-deploy-docs.yaml
File metadata and controls
207 lines (173 loc) · 7.78 KB
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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
name: Create and Deploy Docs
on:
workflow_dispatch:
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-branch:
description: 'Delete deploy-docs branch at the end of process.'
type: boolean
default: true
run-lint:
description: 'Compile and perform lint tests to ensure there is no issues at given branch name.'
type: boolean
default: true
permissions:
contents: read
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
permissions:
contents: read
steps:
- name: 📥 Checkout into ${{ inputs.branch-name }}
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
ref: ${{ inputs.branch-name }}
- 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
permissions:
id-token: write
contents: write
steps:
- name: 📥 Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: 🔐 Azure Login
uses: ./.github/actions/az-login
with:
client-id: ${{ secrets.OSUI_AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.OSUI_AZURE_TENANT_ID }}
subscription-id: ${{ secrets.OSUI_AZURE_SUBSCRIPTION_ID }}
- name: 🔑 Get GitHub Token from Azure Key Vault
id: get-github-token
uses: ./.github/actions/az-keyvault-get
with:
key-name: o11odc-github-gitpersonal-token-prd
- name: 📥 Checkout into ${{ inputs.branch-name }}
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
ref: ${{ inputs.branch-name }}
token: ${{ steps.get-github-token.outputs.az-keyvault-value }}
- 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
permissions:
id-token: write
contents: write
steps:
- name: 📥 Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: 🔐 Azure Login
uses: ./.github/actions/az-login
with:
client-id: ${{ secrets.OSUI_AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.OSUI_AZURE_TENANT_ID }}
subscription-id: ${{ secrets.OSUI_AZURE_SUBSCRIPTION_ID }}
- name: 🔑 Get GitHub Token from Azure Key Vault
id: get-github-token
uses: ./.github/actions/az-keyvault-get
with:
key-name: o11odc-github-gitpersonal-token-prd
- name: 🔧 Configure Git with the UiComponentsBot Token
run: |
git config --global user.email "sa_git_uicomponents@outsystems.com"
git config --global user.name "UiComponentsBot"
- name: 📥 Checkout into deploy-docs
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
ref: deploy-docs
token: ${{ steps.get-github-token.outputs.az-keyvault-value }}
- name: 🕸️ Install project dependencies
run: npm install
- name: 📦 Install graphviz
run: sudo apt install -y graphviz
- name: 🏗️ Generate documentation
run: npm run docs
- name: 🔑 Get GPG Passphrase from Azure Key Vault
id: GetGPGPassphrase
#uses: OutSystems/rd.github-reusable-workflows/.github/actions/az-keyvault-get@9d497d1c5bc6e355aa8f4663539e6b75c212f6b4 #v2.0.7
uses: ./.github/actions/az-keyvault-get
with:
key-name: o11odc-github-gpg-passphrase-prd
- name: 🔏 Sign and commit documentation to branch deploy-docs
#uses: OutSystems/rd.github-reusable-workflows/.github/actions/signed-commit@9d497d1c5bc6e355aa8f4663539e6b75c212f6b4 #v2.0.7
uses: ./.github/actions/signed-commit
with:
commit-branch: deploy-docs
commit-message: 'Update documentation [skip ci]'
commit-new-files: true
gpg-priv-key: ${{ secrets.GPG_SIGN_KEY }}
# gpg-priv-key: ${{ steps.GetGPGKey.outputs.az-keyvault-value }}
gpg-pass-phrase: ${{ steps.GetGPGPassphrase.outputs.az-keyvault-value }}
publish-doc:
needs: [check-repo, create-doc]
runs-on: ubuntu-latest
permissions:
id-token: write
contents: write
steps:
- name: 📥 Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: 🔐 Azure Login
uses: ./.github/actions/az-login
with:
client-id: ${{ secrets.OSUI_AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.OSUI_AZURE_TENANT_ID }}
subscription-id: ${{ secrets.OSUI_AZURE_SUBSCRIPTION_ID }}
- name: 🔑 Get GitHub Token from Azure Key Vault
id: get-github-token
uses: ./.github/actions/az-keyvault-get
with:
key-name: o11odc-github-gitpersonal-token-prd
- name: 📥 Checkout into deploy-docs
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
ref: deploy-docs
token: ${{ steps.get-github-token.outputs.az-keyvault-value }}
- name: 📤 Push documentation files into github page
if: ${{ needs.check-repo.outputs.is-real-osui-repo == 'true' }}
uses: GuillaumeFalourd/copy-push-files@758ee05c45fbd682b62908f2373bf070077a1e43 # v1
with:
source_files: docs/*
remote_repository: https://github.com/outsystems-ui-docs/outsystems-ui-docs.github.io
access_token: ${{ steps.get-github-token.outputs.az-keyvault-value }}
target_branch: main
commit_message: Deploy documentation.
delete-branch:
needs: publish-doc
runs-on: ubuntu-latest
permissions:
id-token: write
contents: write
if: ${{ inputs.delete-branch == true }}
steps:
- name: 📥 Checkout branch dev
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
ref: dev
- name: 🗑️ Delete branch deploy-docs
shell: bash
run: |
git push origin -d deploy-docs