Fix website build and 0.8.x pages, move deploy to workflow and nixify the website part (#982)

This commit is contained in:
Luigi Operoso
2024-03-10 17:30:01 +01:00
committed by GitHub
parent cee202004d
commit 4f03cefda0
20 changed files with 795 additions and 528 deletions
+22 -10
View File
@@ -1,4 +1,4 @@
name: codespell
name: CI Lint
on:
push:
branches:
@@ -8,14 +8,26 @@ on:
types: [opened, synchronize, ready_for_review, reopened]
jobs:
codespell:
name: codespell
name: Codespell
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Codespell
uses: codespell-project/actions-codespell@v2
with:
check_filenames: true
ignore_words_list: aks,ags,startin
skip: "*.js,package-lock.json,*.lock,*/Font-Awesome/*,*.toml,*.svg,*assets/vendor/bootstrap*,cert-manager.crds.yaml"
- name: Checkout
uses: actions/checkout@v4
- name: Codespell
uses: codespell-project/actions-codespell@v2
with:
check_filenames: true
ignore_words_list: aks,ags,startin
skip: "*.js,package-lock.json,*.lock,*/Font-Awesome/*,*.toml,*.svg,*assets/vendor/bootstrap*,cert-manager.crds.yaml"
pre-commit:
name: PreCommit
runs-on: ubuntu-latest
steps:
- uses: actions/setup-python@v5.0.0
- name: Checkout
uses: actions/checkout@v4
- id: files
uses: tj-actions/changed-files@v42
- uses: pre-commit/action@v3.0.1
with:
extra_args: --files ${{ steps.files.outputs.all_changed_files }} --show-diff-on-failure
+71 -52
View File
@@ -1,86 +1,105 @@
name: auto-generate-docs
name: Website
# Run this workflow every time a new commit pushed to your repository
on:
push:
branches:
- master
- main
paths:
- 'docs/**'
- 'website/**'
- 'assets/**'
pull_request:
types: [opened, synchronize, ready_for_review, reopened]
paths:
- 'website/**'
- 'assets/**'
jobs:
# Set the job key. The key is displayed as the job name
# when a job name is not provided
docs:
# Name the Job
name: auto-generate-docs
# Set the type of machine to run on
runs-on: ubuntu-latest
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "website"
cancel-in-progress: false
defaults:
run:
shell: bash
jobs:
update-date:
name: Auto update dates
runs-on: ubuntu-latest
if: github.event_name == 'pull_request' || (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master')
steps:
# Checks out a copy of your repository on the ubuntu-latest machine
- uses: DeterminateSystems/nix-installer-action@v9
with:
diagnostic-endpoint: ""
- uses: DeterminateSystems/magic-nix-cache-action@v3
with:
diagnostic-endpoint: ""
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive # Fetch the Docsy theme
fetch-depth: 0
# Checks if the previous commit introduced any changes to website files
- name: Check for changes
run: |
IS_CHANGED=$(git diff --name-only ${{ github.event.before }} ${{ github.sha }} | grep -Ec "^website*" || :)
[[ $IS_CHANGED -gt 0 ]] && echo "IS_CHANGED=true" >> $GITHUB_ENV || echo "IS_CHANGED=false" >> $GITHUB_ENV
# Sets up the appropriate version of Hugo
- name: Setup Hugo
if: env.IS_CHANGED == 'true'
uses: peaceiris/actions-hugo@v2
with:
hugo-version: '0.113.0'
extended: true
# Sets up node - required by Hugo
- name: Setup Node
if: env.IS_CHANGED == 'true'
uses: actions/setup-node@v4
with:
node-version: '12.x'
# Installs dependencies required by docsy theme
- name: Install docsy dependencies
if: env.IS_CHANGED == 'true'
run: |
cd website
npm install
npm build
sudo npm install -D --save autoprefixer
sudo npm install -D --save postcss-cli
cd ../
- name: Update last modified date in modified docs
if: env.IS_CHANGED == 'true'
run: |
git diff --name-only --diff-filter=d ${{ github.event.before }} ${{ github.sha }} | grep -E "^website*" \
| sed -e 's/\(.*\)/"\1"/' | xargs sed -i "/date:/c\date: $(date +'%Y-%m-%d')"
# Runs makefile goal - checks changes to /website folder and generates docs
- name: Run Makefile goal
if: env.IS_CHANGED == 'true'
env:
DEFAULT_BRANCH: master
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: make generate-docs
# Creates pull request with generated docs
- name: Create Pull Request
if: env.IS_CHANGED == 'true'
uses: peter-evans/create-pull-request@v6
if: env.IS_CHANGED == 'true' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master')
with:
commit-message: Auto-updated docs
branch: docs-generator
title: Auto-generated docs update
body: |
Auto generated docs from master commit ${{ github.sha }}
website-generate:
name: Auto generate website
runs-on: ubuntu-latest
if: github.event_name == 'pull_request' || (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master')
steps:
- uses: DeterminateSystems/nix-installer-action@v9
with:
diagnostic-endpoint: ""
- uses: DeterminateSystems/magic-nix-cache-action@v3
with:
diagnostic-endpoint: ""
- name: Checkout code
uses: actions/checkout@v4
- name: nix checks
run: nix flake check
- name: nix build
env:
HUGO_ENVIRONMENT: production
HUGO_ENV: production
run: nix build .#website
- name: Setup Pages
id: pages
uses: actions/configure-pages@v4
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./result
website-deploy:
name: Deploy website
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master'
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: website-generate
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
+2
View File
@@ -71,6 +71,8 @@ jobs:
make helm-e2e E2E_TEST_ARGS='-ginkgo.v'
- name: Test - bats
env:
BATS_LIB_PATH: "${{ github.workspace }}/.bats"
if: ${{ github.event.inputs.skipTests != 'true' }}
run: make bats-tests