mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-06-26 10:54:28 +02:00
Add update-docs workflow
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
This commit is contained in:
parent
ca3e3f8582
commit
96f41b4d7f
1 changed files with 41 additions and 0 deletions
41
.github/workflows/update-docs.yml
vendored
Normal file
41
.github/workflows/update-docs.yml
vendored
Normal file
|
@ -0,0 +1,41 @@
|
|||
name: Update docs on ti.net
|
||||
on:
|
||||
workflow_dispatch:
|
||||
release:
|
||||
types:
|
||||
- published
|
||||
jobs:
|
||||
trigger:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v2
|
||||
- name: Trigger remote workflow to update docs
|
||||
run: |
|
||||
repo_owner="GothenburgBitFactory"
|
||||
repo_name="ti.net"
|
||||
event_type="update-docs"
|
||||
version="${{ github.event.release.tag_name }}"
|
||||
|
||||
# Collect .adoc documentation files
|
||||
doc_filenames=$(find doc/man1 -name '*.adoc' -type f; find doc/man7 -name '*.adoc' -type f)
|
||||
|
||||
# Format doc_filenames with double quotes and commas
|
||||
formatted_doc_filenames="[ $(echo ${doc_filenames} | sed 's/\S\+/\"&\",/g; s/,$//') ]"
|
||||
|
||||
base64_encoded_files=()
|
||||
while IFS= read -r filename; do
|
||||
base64_encoded_file=$(base64 "${filename}" | tr -d '\n')
|
||||
base64_encoded_files+=("\"${base64_encoded_file}\"")
|
||||
done <<< "${doc_filenames}"
|
||||
|
||||
# Format encoded_file_contents with quotes and commas
|
||||
formatted_encoded_file_contents="[ $(IFS=,; echo "${base64_encoded_files[*]}") ]"
|
||||
|
||||
curl -L \
|
||||
-X POST \
|
||||
-H "Accept: application/vnd.github+json" \
|
||||
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
|
||||
-H "X-GitHub-Api-Version: 2022-11-28" \
|
||||
https://api.github.com/repos/${repo_owner}/${repo_name}/dispatches \
|
||||
-d "{\"event_type\": \"$event_type\", \"client_payload\": {\"version\": \"${version}\", \"doc_filenames\": ${formatted_doc_filenames}, \"encoded_file_contents\": ${formatted_encoded_file_contents} }}"
|
Loading…
Add table
Add a link
Reference in a new issue