Skip to content

docs: build 11ty site for tutorial and statement of work #19

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 16 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .eleventy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
const YAML = require('yaml')
const EleventyNavigationPagination = require("@11ty/eleventy-navigation");
const EleventySyntaxHighlightPlugin = require("@11ty/eleventy-plugin-syntaxhighlight");
const RHDSPlugin = require('./_plugins/rhds.cjs');
const { EleventyRenderPlugin } = require('@11ty/eleventy')

module.exports = function(eleventyConfig) {
eleventyConfig.addDataExtension('yaml', x => YAML.parse(x));
eleventyConfig.addPassthroughCopy('assets');
eleventyConfig.addPassthroughCopy('tutorial/**/*.{png,jpg,jpeg,svg}');

eleventyConfig.addPlugin(EleventySyntaxHighlightPlugin);
eleventyConfig.addPlugin(EleventyNavigationPagination);
eleventyConfig.addPlugin(EleventyRenderPlugin);
eleventyConfig.addPlugin(RHDSPlugin);

return {
templateFormats: [
'md',
'njk',
'html',
],
markdownTemplateEngine: 'njk',
htmlTemplateEngine: 'njk',
}
}
10 changes: 10 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": "@patternfly/elements",
"parserOptions": {
"sourceType": "script"
},
"env": {
"node": true,
"commonjs": true
}
}
69 changes: 69 additions & 0 deletions .github/workflows/pages.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
---
name: Deploy GH Pages

on:
workflow_dispatch:
push:
branches:
- main

jobs:
deploy-pages:
runs-on: ubuntu-latest
name: Build site and deploy to GHPages
env:
ELEVENTY_PATH_PREFIX: '/${{ github.event.repository.name }}/'
steps:
- name: Checkout sources
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Install node 16
uses: actions/setup-node@v3
with:
node-version: '16'
cache: npm

- name: Install project modules
run: npm ci

- name: Build site 1st attempt
continue-on-error: true
id: firstBuild
env:
SITE_GITHUB_TOKEN: "${{ secrets.SITE_GITHUB_TOKEN }}"
run: npm run build

- name: Build site 2nd attempt
if: steps.firstBuild.outcome == 'failure'
env:
SITE_GITHUB_TOKEN: "${{ secrets.SITE_GITHUB_TOKEN }}"
run: npm run build

- name: Configure git
run: |
git config user.name "${{ github.actor }}"
git config user.email "${{ github.actor }}@users.noreply.github.com"

- name: Checkout pages branch
run: |
git checkout gh-pages
git pull origin gh-pages

- name: Copy new files
run: cp -rf _site/* .

- name: Count changed
id: git_status
run: |
changedCount=$(git status --porcelain=v1 --short --untracked-files=all | wc -l)
echo "::set-output name=changedCount::$changedCount"

- name: Push generated site
if: steps.git_status.outputs.changedCount > 0
run: |
git add .
git commit -m "docs: deployed to gh-pages for ${{ github.ref }}"
git push origin gh-pages

143 changes: 143 additions & 0 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
---
name: PR site preview

on:
pull_request:
branches:
- main
types:
- opened
- reopened
- synchronize
- closed
paths-ignore:
- '.github/**'

concurrency:
group: preview-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: write
pull-requests: write

jobs:
build-site-preview:
runs-on: ubuntu-latest
name: Build site preview
if: contains(fromJson('["opened", "reopened", "synchronize"]'), github.event.action)
env:
ELEVENTY_PATH_PREFIX: '/${{ github.event.repository.name }}/pr-previews/pr-${{ github.event.number }}/'
steps:
- name: Checkout sources
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Install node 16
uses: actions/setup-node@v3
with:
node-version: '16'
cache: npm

- name: Install project modules
run: npm ci

- name: Build site 1st attempt
continue-on-error: true
id: firstBuild
env:
SITE_GITHUB_TOKEN: "${{ secrets.SITE_GITHUB_TOKEN }}"
run: npm run build

- name: Build site 2nd attempt
if: steps.firstBuild.outcome == 'failure'
env:
SITE_GITHUB_TOKEN: "${{ secrets.SITE_GITHUB_TOKEN }}"
run: npm run build

- name: Configure git
run: |
git config user.name "${{ github.actor }}"
git config user.email "${{ github.actor }}@users.noreply.github.com"

- name: Checkout pages branch
run: git checkout gh-pages

- name: Create preview target
run: |
mkdir -p pr-previews/pr-${{ github.event.number }}
cp -rf _site/* pr-previews/pr-${{ github.event.number }}

- name: Remove robots.txt from preview
run: rm pr-previews/pr-${{ github.event.number }}/robots.txt

- name: Count changed
id: git_status
run: |
changedCount=$(git status pr-previews/pr-${{ github.event.number }} --porcelain=v1 --short --untracked-files=all | wc -l)
echo "::set-output name=changedCount::$changedCount"

- name: Push preview target
if: steps.git_status.outputs.changedCount > 0
run: |
git add pr-previews/pr-${{ github.event.number }}
git commit -m "docs: deployed preview for pr #${{ github.event.number }}"
git push origin gh-pages

- name: Create a preview link
if: steps.git_status.outputs.changedCount > 0
id: pr_preview
run: |
repoName="${{ github.event.repository.name }}"
cnameFile="CNAME"
if [ -f "$cnameFile" ]; then
cname=$(<$cnameFile)
echo "::set-output name=link::https://$cname/$repoName/pr-previews/pr-${{ github.event.number }}/"
else
owner="${{ github.event.repository.owner.login }}"
echo "::set-output name=link::https://$owner.github.io/$repoName/pr-previews/pr-${{ github.event.number }}/"
fi

- name: Comment with the preview link
if: steps.git_status.outputs.changedCount > 0
uses: marocchino/[email protected]
with:
header: site-preview
message: |
:rocket: Deployed site preview ${{ steps.pr_preview.outputs.link }}

* will be up and ready in a couple of minutes.

remove-site-preview:
runs-on: ubuntu-latest
name: Remove site preview
if: ${{ github.event.action == 'closed' }}
steps:
- name: Checkout sources
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Configure git
run: |
git config user.name "${{ github.actor }}"
git config user.email "${{ github.actor }}@users.noreply.github.com"

- name: Checkout pages branch
run: git checkout gh-pages

- name: Remove preview target
continue-on-error: true
run: |
rm -r pr-previews/pr-${{ github.event.number }}
git add pr-previews/pr-${{ github.event.number }}
git commit -m "docs: removed preview for pr #${{ github.event.number }}"
git push origin gh-pages

- name: Remove the preview link comment
uses: marocchino/[email protected]
with:
header: site-preview
delete: true

3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules
assets/@rhds
_site
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
## Running Locally
### Prerequisites
Node > v16 (it's recommended to use nvm)

```bash
npm ci
npm run start
``````
61 changes: 61 additions & 0 deletions _data/footer.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
socialLinks:
- icon: linkedin
href: https://www.linkedin.com/company/red-hat
content: LinkedIn
- icon: youtube
href: https://www.youtube.com/user/RedHatVideos
content: Youtube
- icon: facebook
href: https://www.facebook.com/redhatinc
content: Facebook
- icon: twitter
href: https://twitter.com/RedHat
content: Twitter
- icon: github
href: https://github.com/redhat-israel
content: GitHub

links:
- heading: המוצרים שלנו
links:
- href: https://www.redhat.com/en/technologies/management/ansible
content: Red Hat Ansible Automation Platform
- href: https://www.redhat.com/en/technologies/linux-platforms/enterprise-linux
content: Red Hat Enterprise Linux
- href: https://www.redhat.com/en/technologies/cloud-computing/openshift
content: Red Hat OpenShift
- href: https://www.redhat.com/en/technologies/cloud-computing/openshift-data-foundation
content: Red Hat OpenShift Data Foundation
- href: https://www.redhat.com/en/technologies/linux-platforms/openstack-platform
content: Red Hat OpenStack Platform
- href: https://www.redhat.com/en/technologies/all-products
content: See all products
Comment on lines +18 to +32

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this for beyond?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can either:

  1. replace the footer content/links with something more appropriate
  2. remove the main footer and use only the global (i.e. legal) footer

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we leave this for a subsequent PR?


- heading: צרו קשר
links:
- href: https://www.redhat.com/en/contact
content: כתבו לנו
- href: https://www.redhat.com/en/about/feedback
content: שלחו לנו פידבק
- href: https://www.redhat.com/en/about/social
content: עקבו אחרינו ברשתות החברתיות


secondary:
- heading: רד האט
content: |
רד האט היא החברה המובילה בעולם לפתרונות תוכנה מבוססי קוד פתוח לארגוני Enterprise.
רד האט מבוססת על כוחה של קהילת הקוד הפתוח בפיתוח ואספקת טכנולוגיות Linux, Cloud, Container, ו-Kubernetes.
אנחנו מסייעים ללקוחות לשלב בין יישומי IT חדשים וקיימים, לפתח יישומים רב-ענניים
(multi-cloud), לבצע סטנדרטיזציה של מערכת ההפעלה, יחד עם אוטומציה, אבטחה וניהול של סביבות מורכבות.

globalLinks:
- href: "https://www.redhat.com/en/about/privacy-policy"
content: הצהרת פרטיות
- href: "https://www.redhat.com/en/about/terms-use"
content: תנאי שימוש
- href: "https://www.redhat.com/en/about/digital-accessibility"
content: נגישות דיגיטלית
# needs client-side js
# - href: "#"
# content: הגדרות עוגיות
Loading