Skip to content

Commit

Permalink
Feat: Deploy docs as a static website
Browse files Browse the repository at this point in the history
  • Loading branch information
clemlesne committed Nov 25, 2023
1 parent 2a02ac7 commit 9ee53e3
Show file tree
Hide file tree
Showing 28 changed files with 707 additions and 414 deletions.
92 changes: 92 additions & 0 deletions .github/workflows/hugo.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
# Sample workflow for building and deploying a Hugo site to GitHub Pages
name: Deploy Hugo site to Pages

on:
push:
branches:
- main

env:
# https://github.com/gohugoio/hugo/releases
HUGO_VERSION: 0.120.4

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: "pages"
cancel-in-progress: false

jobs:
build:
runs-on: ubuntu-22.04
steps:
- name: Set up Hugo CLI
run: |
wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${{ env.HUGO_VERSION }}/hugo_extended_${{ env.HUGO_VERSION }}_linux-amd64.deb \
&& sudo dpkg -i ${{ runner.temp }}/hugo.deb
- name: Set up Dart Sass
run: sudo snap install dart-sass

- name: Checkout
uses: actions/checkout@v4.1.1
with:
submodules: recursive
fetch-depth: 0

- name: Setup Pages
id: pages
uses: actions/configure-pages@v3.0.6

- name: Build with Hugo
working-directory: docs
env:
# For maximum backward compatibility with Hugo modules
HUGO_ENVIRONMENT: production
HUGO_ENV: production
run: |
hugo \
--gc \
--minify \
--baseURL "${{ steps.pages.outputs.base_url }}/"
- name: Upload build artifact
uses: actions/upload-artifact@v3.1.3
with:
name: hugo
path: public

deploy:
environment:
name: github-pages
runs-on: ubuntu-22.04
needs: build
steps:
- name: Pull from gh-pages
uses: actions/checkout@v4.1.1
with:
ref: gh-pages

- name: Clean previous Hugo build
run: |
# Clean all except Helm index
find . -type f -not -name "index.yaml" -delete
- name: Download build artifact
uses: actions/download-artifact@v3.0.2
with:
name: hugo

- name: Commit and push
run: |
# Configure git
git config --global user.name "${{ github.actor }}"
git config --global user.email "${{ github.actor }}@users.noreply.github.com"
# Commit and push
git add .
git commit -m "Deploy hugo site"
git push origin gh-pages
5 changes: 3 additions & 2 deletions .github/workflows/pipeline.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ jobs:
skip_packaging: true
env:
CR_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CR_SKIP_EXISTING: true # Avoid overriding existing files, compat with the Hugo static site

test:
name: Test
Expand Down Expand Up @@ -362,7 +363,7 @@ jobs:
io.artifacthub.package.category=integration-delivery
io.artifacthub.package.keywords=agent,azure,azure-devops,azure-pipelines,container,devops,docker,helm,kubernetes,pipelines,self-hosted,self-hosted-agent,auto-scale,keda
io.artifacthub.package.license=Apache-2.0
io.artifacthub.package.logo-url=https://raw.githubusercontent.com/${{ env.CONTAINER_NAME }}/${{ github.sha }}/logo-1024.png
io.artifacthub.package.logo-url=https://raw.githubusercontent.com/${{ env.CONTAINER_NAME }}/${{ github.sha }}/docs/static/images/logo-1024.png
io.artifacthub.package.maintainers=[{"name":"${{ github.actor }}","email":"${{ github.actor }}@users.noreply.github.com"}]
io.artifacthub.package.prerelease=${{ steps.prerelease.outputs.prerelease }}
io.artifacthub.package.readme-url=https://raw.githubusercontent.com/${{ env.CONTAINER_NAME }}/${{ github.sha }}/README.md
Expand Down Expand Up @@ -537,7 +538,7 @@ jobs:
io.artifacthub.package.category=integration-delivery
io.artifacthub.package.keywords=agent,azure,azure-devops,azure-pipelines,container,devops,docker,helm,kubernetes,pipelines,self-hosted,self-hosted-agent,auto-scale,keda
io.artifacthub.package.license=Apache-2.0
io.artifacthub.package.logo-url=https://raw.githubusercontent.com/${{ env.CONTAINER_NAME }}/${{ github.sha }}/logo-1024.png
io.artifacthub.package.logo-url=https://raw.githubusercontent.com/${{ env.CONTAINER_NAME }}/${{ github.sha }}/docs/static/images/logo-1024.png
io.artifacthub.package.maintainers=[{"name":"${{ github.actor }}","email":"${{ github.actor }}@users.noreply.github.com"}]
io.artifacthub.package.prerelease=${{ steps.prerelease.outputs.prerelease }}
io.artifacthub.package.readme-url=https://raw.githubusercontent.com/${{ env.CONTAINER_NAME }}/${{ github.sha }}/README.md
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[submodule "cicd/version"]
path = cicd/version
url = https://github.com/clemlesne/gitops-version
[submodule "docs/themes/hextra"]
path = docs/themes/hextra
url = https://github.com/imfing/hextra.git
Loading

0 comments on commit 9ee53e3

Please sign in to comment.