-
Notifications
You must be signed in to change notification settings - Fork 0
111 lines (97 loc) · 3.07 KB
/
hub.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
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]"