Skip to content
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

chore: initial 11ty setup #20

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
19 changes: 19 additions & 0 deletions .eleventy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
const YAML = require('yaml')
const RHDSPlugin = require('./_plugins/rhds.cjs');

module.exports = function(eleventyConfig) {
eleventyConfig.addDataExtension('yaml', x => YAML.parse(x));
eleventyConfig.addPassthroughCopy('assets');
eleventyConfig.addPassthroughCopy('tutorial/**/*.{png,jpg,jpeg,svg}');
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
48 changes: 48 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Red Hat Beyond
Red Hat's mentoring program for Computer Science students.
This repository contains various pieces of documentation including
instructions for mentors and parts of the course content.

The documents in this repository are written in [GitHub-Flavored Markdown][gfm]
with some additional shortcodes which apply [Red Hat's Design and Branding Guidelines][ux].

## Contributing

Contributions to the documentation are welcome. Please draft a focused, limited pull request
with your changes. Deploy previews are generated for each PR, so after pushing your changes, a link
to the preview will appear in the PR thread after a few minutes.

Red Hat Beyond uses [eleventy][11ty] to generate web pages from our markdown sources.

### Running Locally

If you would like to preview your changes on your local development machine while working on them,
You may run the [eleventy dev server][dev]. Changes to content will cause the localhost preview to
automatically refresh.

#### Prerequisites

In order to run the dev server, you must have [Node.js][node] v16 or greater installed.
We recommend using [nvm][nvm] to manage node versions on your development machine.

Once node is installed, run the following command to download development dependencies to the
project's `node_modules` folder.

```shell
npm ci
```
Once that command has completed, you may start the dev server with the following command:

```shell
npm start
```

This will launch the dev server at http://localhost:8080 (assuming port 8080 is available).
Open that link in your web browser to view the preview.

[gfm]: https://github.github.com/gfm/
[ux]: https://ux.redhat.com/
[11ty]: https://11ty.dev/
[dev]: https://www.11ty.dev/docs/watch-serve/
[node]: https://nodejs.org/
[nvm]: https://github.com/nvm-sh/nvm/
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

- 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