Skip to content

Build Website

Build Website #2465

Workflow file for this run

name: Build Website
on:
schedule:
- cron: "0 1,13 * * *"
workflow_dispatch:
jobs:
build:
name: Build Website
runs-on: ubuntu-22.04
steps:
- name: Free up disk space
# The website content requires a large amount of free disk space.
run: |
[ -d /usr/local/lib/android ] && sudo rm -rf /usr/local/lib/android
[ -d /usr/share/dotnet ] && sudo rm -rf /usr/share/dotnet
[ -d /opt/ghc ] && sudo rm -rf /opt/ghc
[ -d /opt/hostedtoolcache/CodeQL ] && sudo rm -rf /opt/hostedtoolcache/CodeQL
sudo docker image prune --all --force
df -h
- name: Setup Hugo
uses: peaceiris/actions-hugo@v3
with:
hugo-version: "0.126.1"
- name: Check out code into the Go module directory
uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: docGen/go.mod
cache-dependency-path: docGen/go.sum
- name: Create build folder
run: mkdir avd-repo
- name: Checkout public vuln-list-repo
uses: actions/checkout@v3
with:
repository: aquasecurity/vuln-list
token: ${{ secrets.ORG_REPO_TOKEN }}
path: avd-repo/vuln-list
- name: Checkout public vuln-list-nvd-repo
uses: actions/checkout@v3
with:
repository: aquasecurity/vuln-list-nvd
token: ${{ secrets.ORG_REPO_TOKEN }}
path: avd-repo/vuln-list-nvd
- name: Checkout public vuln-list-redhat-repo
uses: actions/checkout@v3
with:
repository: aquasecurity/vuln-list-redhat
token: ${{ secrets.ORG_REPO_TOKEN }}
sparse-checkout: |
api
path: avd-repo/vuln-list-redhat
- name: Checkout public cloud-security-remediation-guides-repo
uses: actions/checkout@v3
with:
repository: aquasecurity/cloud-security-remediation-guides
token: ${{ secrets.ORG_REPO_TOKEN }}
path: avd-repo/remediations-repo
- name: Checkout public cloudsploit-repo
uses: actions/checkout@v3
with:
repository: aquasecurity/cloudsploit
token: ${{ secrets.ORG_REPO_TOKEN }}
path: avd-repo/cloudsploit-repo
- name: Checkout public trivy-policies-repo
uses: actions/checkout@v3
with:
repository: aquasecurity/trivy-policies
token: ${{ secrets.ORG_REPO_TOKEN }}
path: avd-repo/trivy-policies-repo
- name: Checkout public chain-bench-repo
uses: actions/checkout@v3
with:
repository: aquasecurity/chain-bench
token: ${{ secrets.ORG_REPO_TOKEN }}
path: avd-repo/chain-bench-repo
- name: Build generator
run: make md-clean md-build
- name: Sync avd-repo with latest changes from generator
run: make sync-all
- name: Build and Generate Markdown pages
run: make md-generate
## We have already created *.md files, so we can remove the repositories to save free space.
- name: Remove repositories
run: make remove-all-repos
- name: Generate Hugo website
run: make hugo-generate
- name: Copy assets
run: make copy-assets
- name: Check available disk space
run: df -h
- name: Deploy Search Index to MeiliSearch Instance
run: |
cd avd-repo
curl -H 'Content-Type: application/json' -H 'X-Meili-API-Key: ${{ secrets.SEARCHAPITOKEN }}' -X POST ${{ secrets.SEARCHAPIHOST }}/indexes/avd/documents?primaryKey=title --data @docs/searchindex.json
- name: Install AWS CLI
run: |
python3 -m venv .venv
source .venv/bin/activate
pip3 install awscli
- name: Sync changes to the bucket
run: aws s3 sync --no-progress --only-show-errors --size-only avd-repo/docs ${{ secrets.PROD_AVD_BUCKET }}
env:
AWS_ACCESS_KEY_ID: ${{ secrets.PROD_AVD_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.PROD_AVD_SECRET_ACCESS_KEY }}
AWS_REGION: us-east-1
- name: Microsoft Teams Notification
uses: Skitionek/notify-microsoft-teams@e7a2493ac87dad8aa7a62f079f295e54ff511d88
if: failure()
with:
webhook_url: ${{ secrets.TRIVY_MSTEAMS_WEBHOOK }}
needs: ${{ toJson(needs) }}
job: ${{ toJson(job) }}
steps: ${{ toJson(steps) }}