Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create documentation workflow #1

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Generate Documentation

on:
pull_request:
branches: [ main ]
repository_dispatch:
types: [ generate ]
workflow_dispatch:
schedule:
- cron: '15 5 * * *'

permissions:
contents: read

jobs:
build:
# Only run scheduled workflows on the main repository; prevents people
# from using build minutes on their forks.
if: github.repository == 'libgit2/www.libgit2.org-docs'
name: "Generate documentation"
runs-on: "ubuntu-latest"
steps:
- name: Check out repository
uses: actions/checkout@v4
with:
path: docs
fetch-depth: 0
ssh-key: ${{ secrets.DOCS_PUBLISH_KEY }}
- name: Generate documentation
run: |
npm install
./generate ..
working-directory: docs/_generator
- name: Examine changes
run: |
if [ -n "$(git diff --name-only)" ]; then
echo "changes=true" >> $GITHUB_OUTPUT
else
echo "changes=false" >> $GITHUB_OUTPUT
fi
id: check
working-directory: docs
- name: Publish documentation
run: |
DATE=$(date +"%Y-%m-%d")

git config user.name 'Documentation Site Generator'
git config user.email '[email protected]'
git add .
git commit -m"Documentation update ${DATE}"
git push origin main
if: steps.check.outputs.changes == 'true'
working-directory: docs
2 changes: 1 addition & 1 deletion _generator/generate
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/usr/bin/env bash

set -eo pipefail

Expand Down
Loading