Skip to content

Commit 21712c5

Browse files
authored
Merge pull request #3 from arewm/main
Initial attempt at configuring the rendering framework.
2 parents cb7f9cb + 2e477af commit 21712c5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+12162
-0
lines changed

.github/dependabot.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
version: 2
3+
updates:
4+
- package-ecosystem: "github-actions"
5+
directory: "/"
6+
schedule:
7+
interval: "daily"
8+
- package-ecosystem: "npm"
9+
directory: "/"
10+
schedule:
11+
interval: "daily"

.github/workflows/checks.yaml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# Copyright 2022 Red Hat, Inc.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License..
14+
#
15+
# SPDX-License-Identifier: Apache-2.0
16+
17+
---
18+
name: Check pull request
19+
20+
'on':
21+
pull_request:
22+
branches:
23+
- main
24+
25+
jobs:
26+
antora:
27+
runs-on: ubuntu-latest
28+
steps:
29+
- name: Checkout code
30+
uses: actions/checkout@v3
31+
32+
- name: Cache
33+
uses: actions/cache@v3
34+
with:
35+
path: |
36+
~/.cache/go-build
37+
~/go/pkg/mod
38+
~/.npm
39+
key: docs-${{ hashFiles('package-lock.json') }}
40+
restore-keys: docs-
41+
42+
- uses: actions/setup-node@v3
43+
with:
44+
node-version-file: 'package.json'
45+
46+
- name: Setup Go environment
47+
uses: actions/setup-go@v4
48+
with:
49+
go-version: '1.19'
50+
51+
- name: Install Dependencies
52+
run: npm install
53+
54+
- name: Generate website
55+
run: npm ci && npm run build
56+
57+
- name: Store pull request data
58+
run: |
59+
mkdir pull_request
60+
echo ${{ github.event.pull_request.number }} > ./pull_request/number
61+
62+
- name: Upload artifacts
63+
uses: actions/upload-artifact@v3
64+
with:
65+
name: website
66+
path: |
67+
public
68+
pull_request

.github/workflows/preview.yaml

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# Copyright 2022 Red Hat, Inc.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
#
15+
# SPDX-License-Identifier: Apache-2.0s
16+
17+
name: Publish preview
18+
19+
on:
20+
workflow_run:
21+
workflows: ["Check pull request"]
22+
types:
23+
- completed
24+
25+
jobs:
26+
preview:
27+
runs-on: ubuntu-latest
28+
permissions:
29+
pull-requests: write
30+
if: github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success'
31+
steps:
32+
- name: Download pull request artifact
33+
uses: actions/github-script@v7
34+
with:
35+
script: |
36+
const artifacts = await github.rest.actions.listWorkflowRunArtifacts({
37+
owner: context.repo.owner,
38+
repo: context.repo.repo,
39+
run_id: ${{ github.event.workflow_run.id }},
40+
});
41+
const websiteArtifact = artifacts.data.artifacts.filter((artifact) => {
42+
return artifact.name == 'website'
43+
})[0];
44+
var download = await github.rest.actions.downloadArtifact({
45+
owner: context.repo.owner,
46+
repo: context.repo.repo,
47+
artifact_id: websiteArtifact.id,
48+
archive_format: 'zip',
49+
});
50+
const fs = require('fs');
51+
fs.writeFileSync('${{github.workspace}}/website.zip', Buffer.from(download.data));
52+
- name: Unzip website artifact
53+
run: unzip -q website.zip
54+
- name: Setup pull request data
55+
id: data
56+
run: |
57+
PR_NUMBER=$(head -1 pull_request/number)
58+
PR_NUMBER=${PR_NUMBER//[^0-9]/}
59+
echo "PR_NUMBER=${PR_NUMBER}" >> $GITHUB_OUTPUT
60+
echo "PR_URL=https://github.com/${GITHUB_REPOSITORY}/pull/${PR_NUMBER}" >> $GITHUB_OUTPUT
61+
- name: Preview on Netlify
62+
uses: netlify/actions/cli@master
63+
id: preview
64+
with:
65+
args: deploy --dir=public --alias="pr-${{ steps.data.outputs.PR_NUMBER }}" --message="Preview for ${{ steps.data.outputs.PR_URL}}"
66+
env:
67+
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
68+
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
69+
- name: Add comment
70+
uses: actions/github-script@v7
71+
with:
72+
github-token: ${{ secrets.GITHUB_TOKEN }}
73+
script: |
74+
github.rest.issues.createComment({
75+
issue_number: Number(${{ steps.data.outputs.PR_NUMBER }}),
76+
owner: context.repo.owner,
77+
repo: context.repo.repo,
78+
body: `🚀 Preview is available at ${{ steps.preview.outputs.NETLIFY_URL }}`
79+
})

.github/workflows/publish.yaml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# Copyright 2022 Red Hat, Inc.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
#
15+
# SPDX-License-Identifier: Apache-2.0
16+
17+
---
18+
name: Publish website
19+
20+
'on':
21+
push:
22+
branches:
23+
- main
24+
repository_dispatch:
25+
types:
26+
- update
27+
28+
jobs:
29+
antora:
30+
runs-on: ubuntu-latest
31+
permissions:
32+
pages: write
33+
id-token: write
34+
environment:
35+
name: github-pages
36+
url: ${{ steps.deployment.outputs.page_url }}
37+
steps:
38+
- name: Checkout code
39+
uses: actions/checkout@v3
40+
41+
- name: Cache
42+
uses: actions/cache@v3
43+
with:
44+
path: |
45+
~/.cache/go-build
46+
~/go/pkg/mod
47+
~/.npm
48+
key: docs-${{ hashFiles('package-lock.json') }}
49+
restore-keys: docs-
50+
51+
- uses: actions/setup-node@v3
52+
with:
53+
node-version-file: 'package.json'
54+
55+
- name: Setup Go environment
56+
uses: actions/setup-go@v4
57+
with:
58+
go-version: '1.19'
59+
60+
- name: Generate website
61+
run: npm ci && npm run build
62+
63+
- name: Setup Pages
64+
uses: actions/configure-pages@v4
65+
66+
- name: Upload artifact
67+
uses: actions/upload-pages-artifact@v2
68+
with:
69+
path: 'public'
70+
71+
- name: Deploy to GitHub Pages
72+
id: deployment
73+
uses: actions/deploy-pages@v3

.github/workflows/size-label.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Size label
2+
on: pull_request_target
3+
jobs:
4+
size-label:
5+
permissions:
6+
contents: read
7+
pull-requests: write
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Install jq
11+
run: |
12+
sudo apt-get update
13+
sudo apt-get install -y jq
14+
- name: Size label
15+
uses: actions/checkout@v3
16+
with:
17+
token: ${{ secrets.GITHUB_TOKEN }}
18+
- name: Calculate size
19+
run: |
20+
additions=$(curl -s "https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}" | jq '.additions')
21+
deletions=$(curl -s "https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}" | jq '.deletions')
22+
size=$((additions + deletions))
23+
echo "SIZE=$size" >> $GITHUB_ENV
24+
- name: Add label
25+
run: |
26+
if [ ${{ env.SIZE }} -gt 100 ]; then
27+
echo "Adding size: XXL"
28+
curl -X POST -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
29+
-H "Accept: application/vnd.github.v3+json" \
30+
https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/labels \
31+
-d '["size: XXL"]'
32+
elif [ ${{ env.SIZE }} -gt 50 ]; then
33+
echo "Adding size: XL"
34+
curl -X POST -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
35+
-H "Accept: application/vnd.github.v3+json" \
36+
https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/labels \
37+
-d '["size: XL"]'
38+
elif [ ${{ env.SIZE }} -gt 30 ]; then
39+
echo "Adding size: L"
40+
curl -X POST -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
41+
-H "Accept: application/vnd.github.v3+json" \
42+
https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/labels \
43+
-d '["size: L"]'
44+
elif [ ${{ env.SIZE }} -gt 15 ]; then
45+
echo "Adding size: M"
46+
curl -X POST -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
47+
-H "Accept: application/vnd.github.v3+json" \
48+
https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/labels \
49+
-d '["size: M"]'
50+
elif [ ${{ env.SIZE }} -gt 5 ]; then
51+
echo "Adding size: S"
52+
curl -X POST -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
53+
-H "Accept: application/vnd.github.v3+json" \
54+
https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/labels \
55+
-d '["size: S"]'
56+
else
57+
echo "Adding size: XS"
58+
curl -X POST -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
59+
-H "Accept: application/vnd.github.v3+json" \
60+
https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/labels \
61+
-d '["size: XS"]'
62+
fi
63+

.gitignore

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# gitignore for HAC BS documentation git repository
2+
3+
# HAC BS documentation is stored in adoc (AsciiDoc) format. Typically the
4+
# adoc is converting into HTML to verify syntax while writing the files,
5+
# but the HTML file should not be stored in git since the HTML files will
6+
# likely get out of sync with the source (adoc) files. Web browsers will read adoc and convert into HTML when displaying the contents.
7+
8+
**/*.html
9+
10+
# Python object files
11+
*.py[cod]
12+
13+
# vim swap files
14+
[._]*.s[a-v][a-z]
15+
[._]*.sw[a-p]
16+
[._]s[a-rt-v][a-z]
17+
[._]ss[a-gi-z]
18+
[._]sw[a-p]
19+
20+
# vim temporary files
21+
*~
22+
23+
# tmp dir
24+
tmp/
25+
26+
# Antora working directories
27+
node_modules/
28+
build/
29+
public/
30+
.idea/
31+
.cache
32+
33+
# Netlify deploy output from preview workflow
34+
deploy.json
35+
.DS_Store

.vscode/extensions.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
// See https://go.microsoft.com/fwlink/?LinkId=827846
3+
// for the documentation about the extensions.json format
4+
"recommendations": [
5+
"redhat.vscode-yaml",
6+
"redhat.vscode-xml",
7+
"timonwong.shellcheck",
8+
"errata-ai.vale-server",
9+
"asciidoctor.asciidoctor-vscode"
10+
]
11+
}

.vscode/settings.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"asciidoc.antora.enableAntoraSupport": true,
3+
"editor.wordWrap": "on"
4+
}

0 commit comments

Comments
 (0)