fix: add valid input for sed #12
Workflow file for this run
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 docs | |
on: push | |
jobs: | |
build_docs: | |
runs-on: "ubuntu-20.04" | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v3 | |
- name: Build docs | |
run: make docs | |
- name: Get current git ref | |
id: rev_parse | |
run: echo "COMMIT_HASH=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | |
- name: Checkout ooni/docs | |
uses: actions/checkout@v2 | |
with: | |
repository: "ooni/docs" | |
ssh-key: ${{ secrets.OONI_DOCS_DEPLOYKEY }} | |
path: "ooni-docs" | |
- name: Update docs | |
run: | | |
mkdir -p ooni-docs/src/content/docs/probe-engine/ | |
mkdir -p ooni-docs/src/assets/images-probe-engine/ | |
cp -R dist/docs/img/* ooni-docs/src/assets/images-probe-engine/ | |
rm -r dist/docs/img | |
cp -R dist/docs/* ooni-docs/src/content/docs/probe-engine/ | |
- name: Check for conflicting slugs | |
run: | | |
cat ooni-docs/src/content/docs/probe-engine/*.md \ | |
| grep "^slug:" | awk -F':' '{gsub(/^ +/, "", $2); print $2}' | sort | uniq -c \ | |
| awk '{if ($1 > 1) { print "duplicate slug for: " $2; exit 1}}' | |
- name: Print the lines of the generated docs | |
run: wc -l ooni-docs/src/content/docs/probe-engine/* | |
- name: Print assets used in docs | |
run: ls ooni-docs/src/assets | |
- name: Commit changes | |
# Only push the docs update when we are in master | |
if: github.ref == 'refs/heads/master' | |
run: | | |
cd ooni-docs | |
git config --global user.email "github+backend@ooni.org" | |
git config --global user.name "OONI Github Actions Bot" | |
git add . | |
git commit -m "auto: update probe-engine docs to ${{ steps.rev_parse.outputs.COMMIT_HASH }}" || echo "No changes to commit" | |
git push origin |