Skip to content
Merged
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
59 changes: 21 additions & 38 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
@@ -1,56 +1,39 @@
name: Deploy to GitHub Pages

on:
workflow_dispatch:
# Trigger the workflow every time you push to the `main` branch
# Using a different branch name? Replace `main` with your branch’s name
push:
branches:
- main
# Review gh actions docs if you want to further define triggers, paths, etc
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#on
branches: [ main ]
# Allows you to run this workflow manually from the Actions tab on GitHub.
workflow_dispatch:

# Allow this job to clone the repo and create a page deployment
permissions:
contents: read
pages: write
id-token: write

jobs:
build:
name: Build Site
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: 20
cache: npm

- name: Install dependencies
run: npm install
- name: Run astro check
run: npm run astro check
- name: Run lint
run: npm run lint
- name: Test build website
run: npm run build

- name: Upload Build Artifact
uses: actions/upload-pages-artifact@v3
with:
path: dist
- name: Checkout your repository using git
uses: actions/checkout@v4
- name: Install, build, and upload your site
uses: withastro/action@v3
# with:
# path: . # The root location of your Astro project inside the repository. (optional)
# node-version: 20 # The specific version of Node that should be used to build your site. Defaults to 20. (optional)
# package-manager: pnpm@latest # The Node package manager that should be used to install dependencies and build your site. Automatically detected based on your lockfile. (optional)

deploy:
name: Deploy to GitHub Pages
needs: build

# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source

# Deploy to the github-pages environment
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}

runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
uses: actions/deploy-pages@v4
15 changes: 13 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,21 @@ EducatesHub is a static site built with [Astro](https://astro.build/) and TypeSc
3. **Open your browser:**
Visit [http://localhost:4321](http://localhost:4321)

## Customizing Workshops
## Adding Educates Resources

- Add or edit YAML files in `src/data/` to update the workshop catalog.
- Add or edit YAML files in `src/content/` to update the workshop, extensions, kyverno policies or themes catalog.
- Images referenced in YAML should be placed in `public/images/` or mapped in the loader utility.
- Fetch referenced assets, run `./fetch_assets.sh` to fetch referenced workshops, kyverno policies, themes and extensions.

## Release a new version of the site

- Always work in develop branch
- Make sure that everything works locally and make astro check:
```
npm run astro check
```
- When things are ready to be released, merge code into main via PR (this will publish the site)
- Rebase develop on main

## Contributing

Expand Down
1 change: 1 addition & 0 deletions astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ import react from "@astrojs/react";
// https://astro.build/config
export default defineConfig({
integrations: [react()],
site: 'https://hub.educates.dev',
});
29 changes: 29 additions & 0 deletions fetch_assets.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/bash
set -e

WORKSHOP_DIR="src/content/workshops"
ASSET_DIR="public/assets/workshops"
mkdir -p "$ASSET_DIR"

for yaml in "$WORKSHOP_DIR"/*.yaml*; do
# Extract slug (first occurrence)
slug=$(grep '^slug:' "$yaml" | head -n1 | awk '{print $2}')
# Extract install_url (first occurrence)
url=$(grep '^install_url:' "$yaml" | head -n1 | awk '{print $2}')
if [ -z "$slug" ]; then
echo "No slug found in $yaml, skipping."
continue
fi
if [ -n "$url" ]; then
outname="$slug.yaml"
echo "Downloading $url to $ASSET_DIR/$outname"
if curl -sSL --fail "$url" -o "$ASSET_DIR/$outname"; then
echo "Downloaded successfully."
else
echo "Failed to download $url (not found or error)."
rm -f "$ASSET_DIR/$outname"
fi
else
echo "No install_url found in $yaml, skipping."
fi
done
Loading