Build and Deploy Hub #18149
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Deploy Hub | |
on: | |
push: | |
schedule: | |
- cron: "0 6-19 * * *" | |
env: | |
PROJECT_SLUG: component-hub | |
OUT_DIR: build | |
jobs: | |
generate: | |
name: Generate Antora Site π¦ | |
runs-on: ubuntu-latest | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v4 | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.9 | |
- name: Install Poetry | |
uses: Gr1N/setup-poetry@v9 | |
- name: Setup Cache | |
uses: actions/cache@v4 | |
with: | |
path: ~/.cache/pypoetry/virtualenvs | |
key: ${{ runner.os }}-poetry-${{ hashFiles('poetry.lock') }} | |
- name: Install Python Dependencies | |
run: poetry install | |
- name: Configure Git | |
run: | | |
git config --global init.defaultBranch master && \ | |
git config --global user.email "[email protected]" && \ | |
git config --global user.name "Hub Action" | |
- name: Retrieve current GitHub API Rate Limits | |
run: | | |
date && date "+%s" && \ | |
curl -s \ | |
-H "Accept: application/vnd.github.v3+json" \ | |
-H "Authorization: token $GITHUB_TOKEN" \ | |
https://api.github.com/rate_limit | |
- name: Generate Antora Site | |
run: | | |
poetry run component-hub \ | |
--root $OUT_DIR \ | |
--slug $PROJECT_SLUG \ | |
--ignore-list reposignore.txt \ | |
make | |
- name: Commit changes | |
run: | | |
cd "$OUT_DIR"/"$PROJECT_SLUG" && \ | |
git add . && \ | |
git commit -m "First commit" | |
- name: Upload generated site configuration | |
uses: actions/upload-artifact@v4 | |
with: | |
name: antora-site-configuration | |
path: build/ | |
include-hidden-files: true | |
build: | |
name: Build Antora Site πͺ | |
runs-on: ubuntu-latest | |
needs: generate | |
steps: | |
- name: Download Antora Site configuration | |
uses: actions/download-artifact@v4 | |
with: | |
name: antora-site-configuration | |
- name: Build Antora Site | |
env: | |
antora_cmd: '$(docker_cmd) run $(docker_opts) --volume "$${PWD}":/antora --env DOCSEARCH_ENABLED=true --env DOCSEARCH_ENGINE=lunr ghcr.io/vshn/antora:3.1.2.2' | |
antora_opts: "--cache-dir=.cache/antora --generator antora-site-generator-lunr" | |
run: cd $PROJECT_SLUG; make html | |
- name: Upload built Antora Site | |
uses: actions/upload-artifact@v4 | |
with: | |
name: antora-site | |
path: component-hub | |
include-hidden-files: true | |
deploy: | |
name: Deploy Antora Site π | |
runs-on: ubuntu-latest | |
needs: build | |
if: github.ref == 'refs/heads/master' | |
steps: | |
- name: Download Antora Site | |
uses: actions/download-artifact@v4 | |
with: | |
name: antora-site | |
- name: Deploy to GitHub Pages | |
uses: JamesIves/github-pages-deploy-action@v4 | |
with: | |
branch: gh-pages | |
folder: _public | |
git-config-name: "Hub Action" | |
git-config-email: "[email protected]" |