Skip to content

Documentation ci pr devel #128

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

Open
wants to merge 54 commits into
base: devel
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
1ba4d00
Adding CI to build and publish ce-dev docs automatically.
gregharvey Jan 17, 2022
e92364f
Merging devel.
gregharvey Jan 17, 2022
bdaca88
Merge branch '1.x' into documentation_ci
gregharvey Jan 17, 2022
07faf47
Merge branch 'documentation_ci' into documentation_ci-PR-devel
gregharvey Jan 17, 2022
c002862
ce-dev didn't have the toc.sh docs builder script.
gregharvey Jan 17, 2022
e020d7b
Merge branch 'documentation_ci' into documentation_ci-PR-devel
gregharvey Jan 17, 2022
398cf8c
Removing doc push step from build job, it has its own job now.
gregharvey Jan 17, 2022
5ff9972
Merge branch 'documentation_ci' into documentation_ci-PR-devel
gregharvey Jan 17, 2022
5bee26c
Fix docker-compose v2 issue and re-release to include clamav role (#68)
nfawbert Jan 28, 2022
e42ebd1
Killing old ce-dev container when updating (#70)
nfawbert Feb 2, 2022
b0dc9d9
Added Drupal9 and Localgov templates (#73)
DionisioFG Mar 9, 2022
34ce84c
New release 1.1.19 (#75)
DionisioFG Mar 10, 2022
cae50ba
Updated package.json version: 1.1.19 (#77)
DionisioFG Mar 10, 2022
79372e7
New tag to fix repo key for Chrome (#83)
DionisioFG Jul 1, 2022
4fa738c
#CE-62820: Added support for composer '2.x' in Drupal 9 provision tem…
davids4 Sep 8, 2022
70954a3
REL 1.1.21: Using composer 2 with Drupal 9 by default (#92)
DionisioFG Sep 8, 2022
62e753e
Drupal template fixes pr 1.x (#94)
gregharvey Sep 9, 2022
710a4e3
CE-DEV: some updates and tweaks (#96)
DionisioFG Sep 14, 2022
6046092
Release 1.1.23 (#97)
DionisioFG Sep 14, 2022
2dc8b59
Bump minimist from 1.2.5 to 1.2.6 (#79)
dependabot[bot] Sep 15, 2022
dd597b8
Bump ansi-regex from 3.0.0 to 3.0.1 (#84)
dependabot[bot] Sep 15, 2022
4f0e659
Bump moment from 2.27.0 to 2.29.4 (#85)
dependabot[bot] Sep 15, 2022
2dc648c
Changing 'set-current' choice to a valid one.
gregharvey Sep 15, 2022
8434c0d
Fixing ce_provision vars in container builds. (#102)
gregharvey Apr 14, 2023
0581ade
Adding variables pr 1.x (#104)
gregharvey Apr 14, 2023
fdc01d0
Adding variables pr 1.x (#106)
gregharvey Apr 14, 2023
dd3d9fc
Adding variables pr 1.x (#109)
gregharvey Apr 14, 2023
cd1345b
Adding variables pr 1.x (#111)
gregharvey Apr 14, 2023
7c9e1bc
Fix setup on a Mac: use Docker Compose V2 with the new 'cgroup' param…
iKristjan May 17, 2023
2c8d2ff
Bump minimatch from 3.0.4 to 3.1.2 (#107)
dependabot[bot] May 18, 2023
8325116
Merge branch '1.x' of github.com:codeenigma/ce-dev into 1.x
gregharvey May 18, 2023
c884a4f
Cgroup fixes pr 1.x (#115)
gregharvey May 18, 2023
d4b8b37
Merge branch '1.x' of github.com:codeenigma/ce-dev into 1.x
gregharvey May 18, 2023
6578ae9
Adding new required ce-provision rkhunter variable. (#119)
gregharvey May 22, 2023
fd04f9c
Issue 120: docker ps change, can no longer use --format *and* --quiet…
galooph Jul 10, 2023
0d25cfe
REL 1.2.1: Fix --quiet and --format use (#123)
DionisioFG Jul 10, 2023
6ddcb4d
Drupal template fixes pr 1.x (#126)
gregharvey Jul 18, 2023
45cdf89
Bump semver from 5.7.1 to 5.7.2 (#124)
dependabot[bot] Jul 18, 2023
539ef32
Merging 1.x.
gregharvey Jul 18, 2023
597691f
Updating docs URL for CI to https.
gregharvey Jul 18, 2023
262c69b
Merging devel.
gregharvey Jul 18, 2023
523aec7
Merge branch 'documentation_ci' into documentation_ci-PR-devel
gregharvey Jul 18, 2023
f347208
Updating docs URL for CI to https. (#131)
gregharvey Jul 18, 2023
9e6df79
Drupal template fixes pr 1.x (#133)
gregharvey Jul 18, 2023
2746cd5
Drupal template fixes pr 1.x (#135)
gregharvey Jul 18, 2023
06bf830
Drupal template fixes pr 1.x (#138)
gregharvey Jul 19, 2023
0ae2dc6
Packaging 1.2.2 with new Drupal templates.
gregharvey Jul 19, 2023
57de3cd
Drupal template fixes pr 1.x (#140)
gregharvey Jul 19, 2023
6e51555
Upgrading base container to bullseye-slim. (#141)
gregharvey Jul 20, 2023
c56b900
Adding release info.
gregharvey Jul 20, 2023
845c62f
66912: Added Drupal10 template (#144)
DionisioFG Aug 29, 2023
70c6abb
Merge branch '1.x' into documentation_ci
gregharvey Oct 25, 2023
481c386
Merge branch 'devel' into documentation_ci-PR-devel
gregharvey Oct 25, 2023
543fefc
Merge branch 'documentation_ci' into documentation_ci-PR-devel
gregharvey Oct 25, 2023
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
48 changes: 48 additions & 0 deletions .github/workflows/ce-provision-build-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Build docs

# Run this workflow every time a new commit pushed to your repository
on: pull_request

jobs:
# Set the job key. The key is displayed as the job name
# when a job name is not provided
build-docs:
# Name the Job
name: Build the documentation
# Set the type of machine to run on
runs-on: ubuntu-20.04

steps:
# Checks out a copy of your repository on the ubuntu-latest machine
- name: Checkout code
if: ${{ github.event.pull_request.head.ref != 'documentation' }}
uses: actions/checkout@v2

# Configures global Git variables for committing
- name: Configure Git
run: |
git config --global user.email "[email protected]"
git config --global user.name "Code Enigma CI"

# Builds the docs
- name: Build documentation
if: ${{ github.event.pull_request.head.ref != 'documentation' }}
run: |
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
git fetch
git checkout documentation
contribute/toc.sh
git add docs
git diff --quiet && git diff --staged --quiet || git commit -am 'GitHub Actions - Rebuilt documentation.' && git push origin documentation
shell: bash

# Create docs pull request
- name: Create a documentation pull request
if: ${{ github.event.pull_request.head.ref != 'documentation' && github.event.pull_request.base.ref == '1.x' }}
uses: devops-infra/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
source_branch: documentation
target_branch: ${{ github.event.pull_request.base.ref }}
title: Documentation update.
body: "**Automated pull request** created by GitHub Actions because of a documentation update."
140 changes: 140 additions & 0 deletions contribute/toc.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
#!/bin/sh
# shellcheck disable=SC2094
# shellcheck disable=SC2129
IFS=$(printf '\n\t')
set -e
OWN_DIR=$(dirname "$0")
cd "$OWN_DIR" || exit 1
OWN_DIR=$(git rev-parse --show-toplevel)
cd "$OWN_DIR" || exit 1
OWN_DIR=$(pwd -P)

# @param
# $1 string filepath
cp_role_page(){
RELATIVE=$(realpath --relative-to="$OWN_DIR" "$(dirname "$1")")
if [ ! -d "$OWN_DIR/docs/$RELATIVE" ]; then
mkdir -p "$OWN_DIR/docs/$RELATIVE"
fi
cp "$1" "$OWN_DIR/docs/$RELATIVE.md"
}

# @param
# $1 string folder
cp_single_page(){
if [ ! -d "$OWN_DIR/docs/$1" ]; then
mkdir "$OWN_DIR/docs/$1"
fi
cp "$OWN_DIR/$1/README.md" "$OWN_DIR/docs/$1.md"
}

# @param
# $1 (string) filename
parse_role_variables(){
TMP_MD=$(mktemp)
WRITE=1
# Ensure we have a trailing line.
echo "" >> "$1"
while read -r LINE; do
case $LINE in
'<!--ROLEVARS-->')
echo "$LINE" >> "$TMP_MD"
generate_role_variables "$1"
WRITE=0
;;
'<!--ENDROLEVARS-->')
echo "$LINE" >> "$TMP_MD"
WRITE=1
;;
'<!--TOC-->')
echo "$LINE" >> "$TMP_MD"
WRITE=0
;;
'<!--ENDTOC-->')
echo "$LINE" >> "$TMP_MD"
WRITE=1
;;
*)
if [ $WRITE = 1 ]; then
echo "$LINE" >> "$TMP_MD"
fi
;;
esac
done < "$1"
printf '%s\n' "$(cat "$TMP_MD")" > "$1"
rm "$TMP_MD"
}

# @param
# $1 (string) filename
generate_role_variables(){
VAR_FILE="$(dirname "$1")/defaults/main.yml"
if [ -f "$VAR_FILE" ]; then
echo "## Default variables" >> "$TMP_MD"
echo '```yaml' >> "$TMP_MD"
cat "$VAR_FILE" >> "$TMP_MD"
echo "" >> "$TMP_MD"
echo '```' >> "$TMP_MD"
echo "" >> "$TMP_MD"
fi
}

generate_roles_toc(){
TMP_SIDEBAR=$(mktemp)
WRITE="true"
while read -r LINE; do
case $LINE in
" - [Roles](roles)")
echo "$LINE" >> "$TMP_SIDEBAR"
parse_roles_toc roles 2
WRITE="false"
;;
" -"*)
WRITE="true"
echo "$LINE" >> "$TMP_SIDEBAR"
;;
*)
if [ "$WRITE" = "true" ]; then
echo "$LINE" >> "$TMP_SIDEBAR"
fi
;;
esac
done < "$OWN_DIR/docs/_Sidebar.md"
mv "$TMP_SIDEBAR" "$OWN_DIR/docs/_Sidebar.md"
}

parse_roles_toc(){
ROLES=$(find "$OWN_DIR/$1" -mindepth 2 -maxdepth 2 -name "README.md" | sort)
for ROLE in $ROLES; do
WRITE="true"
INDENT=$(printf %$(($2 * 2))s)
RELATIVE=$(realpath --relative-to="$OWN_DIR" "$(dirname "$ROLE")")
while read -r LINE; do
case $LINE in
"# "*)
if [ "$WRITE" = "true" ]; then
TITLE=$(echo "$LINE" | cut -c 3-)
echo "$INDENT"" - [$TITLE](/$RELATIVE)" >> "$TMP_SIDEBAR"
WRITE="false"
fi
;;
esac
done < "$ROLE"
parse_roles_toc "$RELATIVE" $(($2 + 1))
done
}

rm -rf "$OWN_DIR/docs/roles"
ROLE_PAGES=$(find "$OWN_DIR/roles" -name "README.md")
for ROLE_PAGE in $ROLE_PAGES; do
parse_role_variables "$ROLE_PAGE"
done
for ROLE_PAGE in $ROLE_PAGES; do
cp_role_page "$ROLE_PAGE"
done
generate_roles_toc


cp_single_page install
cp_single_page contribute
cp_single_page scripts