Skip to content

Commit aa56ac9

Browse files
committed
Create documentation workflow
1 parent 87d8d18 commit aa56ac9

File tree

2 files changed

+54
-1
lines changed

2 files changed

+54
-1
lines changed

.github/workflows/main.yml

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Generate Documentation
2+
3+
on:
4+
pull_request:
5+
branches: [ main ]
6+
repository_dispatch:
7+
types: [ generate ]
8+
workflow_dispatch:
9+
schedule:
10+
- cron: '15 5 * * *'
11+
12+
permissions:
13+
contents: read
14+
15+
jobs:
16+
build:
17+
# Only run scheduled workflows on the main repository; prevents people
18+
# from using build minutes on their forks.
19+
if: github.repository == 'libgit2/www.libgit2.org-docs'
20+
name: "Generate documentation"
21+
runs-on: "ubuntu-latest"
22+
steps:
23+
- name: Check out repository
24+
uses: actions/checkout@v4
25+
with:
26+
path: docs
27+
fetch-depth: 0
28+
ssh-key: ${{ secrets.DOCS_PUBLISH_KEY }}
29+
- name: Generate documentation
30+
run: |
31+
npm install
32+
./generate ..
33+
working-directory: docs/_generator
34+
- name: Examine changes
35+
run: |
36+
if [ -n "$(git diff --name-only)" ]; then
37+
echo "changes=true" >> $GITHUB_OUTPUT
38+
else
39+
echo "changes=false" >> $GITHUB_OUTPUT
40+
fi
41+
id: check
42+
working-directory: docs
43+
- name: Publish documentation
44+
run: |
45+
DATE=$(date +"%Y-%m-%d")
46+
47+
git config user.name 'Documentation Site Generator'
48+
git config user.email '[email protected]'
49+
git add .
50+
git commit -m"Documentation update ${DATE}"
51+
git push origin main
52+
if: steps.check.outputs.changes == 'true'
53+
working-directory: docs

_generator/generate

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/sh
1+
#!/usr/bin/env bash
22

33
set -eo pipefail
44

0 commit comments

Comments
 (0)