Skip to content
Merged
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
9 changes: 9 additions & 0 deletions .changeset/changesets/financially-central-pipit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
lldap-operator-helm-chart: none
lldap-operator-reconciler: none
lldap-operator: none
lldap-operator-traits: none
lldap-operator-client: none
lldap-operator-crds: none
---
Rename project from lldap-resources-operator to lldap-operator
21 changes: 21 additions & 0 deletions .github/scripts/generate-redirect.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env bash
set -euo pipefail

LATEST="${1}"
OUTPUT="${2:-index.html}"

cat > "$OUTPUT" << HTMLEOF
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="refresh" content="0; url=/${LATEST}/">
<title>Redirecting to latest docs</title>
</head>
<body>
<p>Redirecting to <a href="/${LATEST}/">latest documentation (${LATEST})</a></p>
</body>
</html>
HTMLEOF

echo "Generated root redirect -> /${LATEST}/"
42 changes: 42 additions & 0 deletions .github/scripts/generate-versions-json.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/usr/bin/env bash
set -euo pipefail

GH_PAGES_DIR="${1:-.}"
OUTPUT="${2:-versions.json}"

VERSIONS=()
for dir in "$GH_PAGES_DIR"/v*/; do
[ -d "$dir" ] || continue
VERSIONS+=("$(basename "$dir")")
done

if [[ ${#VERSIONS[@]} -eq 0 ]]; then
SORTED=()
else
IFS=$'\n'
SORTED=($(printf '%s\n' "${VERSIONS[@]}" | sed 's/^v//' | sort -t. -k1,1rn -k2,2rn -k3,3rn | sed 's/^/v/'))
unset IFS
fi

LATEST="${SORTED[0]:-}"

HAS_MAIN=false
if [ -d "$GH_PAGES_DIR/main-branch" ]; then
HAS_MAIN=true
fi

{
echo '{'
echo " \"latest\": \"${LATEST}\","
echo " \"has_main\": ${HAS_MAIN},"
echo ' "versions": ['
for i in "${!SORTED[@]}"; do
COMMA=","
if [ "$i" -eq $(( ${#SORTED[@]} - 1 )) ]; then COMMA=""; fi
echo " \"${SORTED[$i]}\"${COMMA}"
done
echo ' ]'
echo '}'
} > "$OUTPUT"

echo "Generated $OUTPUT with ${#SORTED[@]} versions (latest: $LATEST)"
38 changes: 37 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,40 @@ jobs:
- uses: azure/setup-helm@v4

- name: Lint Helm chart
run: helm lint charts/lldap-resources-operator
run: helm lint charts/lldap-operator

docs:
name: Documentation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6

- name: Install mdBook
uses: peaceiris/actions-mdbook@v2
with:
mdbook-version: '0.5.2'

- name: Build book
run: mdbook build docs

deploy-docs:
name: Deploy Main Branch Docs
needs: docs
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
permissions:
actions: write
steps:
- name: Trigger docs deployment
uses: actions/github-script@v7
with:
script: |
await github.rest.actions.createWorkflowDispatch({
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: 'deploy-docs.yml',
ref: 'main',
inputs: {
version: 'main-branch'
}
});
96 changes: 96 additions & 0 deletions .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
---
name: Deploy Docs

# Triggered explicitly: by ci.yml (main-branch) or release.yml (versioned).
# The workflow YAML is always read from the dispatching ref (usually main),
# but docs content is checked out from the target ref (tag or main). If the
# mdBook configuration changes incompatibly between versions, older docs may
# not build correctly with the current workflow.
on:
workflow_dispatch:
inputs:
version:
description: >-
Version to deploy (e.g. v0.3.0) or "main-branch" for dev docs
required: true
type: string

permissions:
contents: write

concurrency:
group: deploy-docs
cancel-in-progress: false

jobs:
deploy:
name: Build and Deploy Documentation
runs-on: ubuntu-latest
steps:
- name: Determine deployment target
id: target
run: |
VERSION="${{ inputs.version }}"
if [[ "$VERSION" == "main-branch" ]]; then
echo "destination=main-branch" >> "$GITHUB_OUTPUT"
echo "is_release=false" >> "$GITHUB_OUTPUT"
echo "ref=${{ github.sha }}" >> "$GITHUB_OUTPUT"
echo "Deploying main-branch docs to /main-branch/"
elif [[ "$VERSION" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.]+)?$ ]]; then
echo "destination=${VERSION}" >> "$GITHUB_OUTPUT"
echo "is_release=true" >> "$GITHUB_OUTPUT"
echo "ref=lldap-operator@${VERSION}" >> "$GITHUB_OUTPUT"
echo "Deploying release docs to /${VERSION}/"
else
echo "::error::Invalid version format '${VERSION}'. Expected 'vX.Y.Z' (e.g. v0.3.0) or 'main-branch'."
exit 1
fi

- name: Checkout source
uses: actions/checkout@v6
with:
ref: ${{ steps.target.outputs.ref }}

- name: Install mdBook
uses: peaceiris/actions-mdbook@v2
with:
mdbook-version: '0.5.2'

- name: Build book
run: mdbook build docs

- name: Deploy versioned docs
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/book
destination_dir: ${{ steps.target.outputs.destination }}
keep_files: true

- name: Update versions.json and root redirect
if: steps.target.outputs.is_release == 'true'
run: |
git fetch origin gh-pages
git worktree add /tmp/gh-pages gh-pages

chmod +x .github/scripts/generate-versions-json.sh
.github/scripts/generate-versions-json.sh /tmp/gh-pages /tmp/versions.json

LATEST=$(python3 -c "import json; print(json.load(open('/tmp/versions.json'))['latest'])")

chmod +x .github/scripts/generate-redirect.sh
.github/scripts/generate-redirect.sh "$LATEST" /tmp/root-index.html

cp /tmp/versions.json /tmp/gh-pages/versions.json
cp /tmp/root-index.html /tmp/gh-pages/index.html

cd /tmp/gh-pages
git add versions.json index.html
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git commit -m "Update versions.json and root redirect for ${{ inputs.version }}" \
|| echo "No changes to commit"
git push origin gh-pages

cd -
git worktree remove /tmp/gh-pages
5 changes: 2 additions & 3 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
name: E2E Tests

on:
pull_request:
branches: [main]
workflow_dispatch:

permissions:
contents: read
Expand Down Expand Up @@ -39,7 +38,7 @@ jobs:

- name: Install operator via Helm
run: |
helm install lldap-operator charts/lldap-resources-operator \
helm install lldap-operator charts/lldap-operator \
--set image.repository=lldap-operator \
--set image.tag=test \
--set image.pullPolicy=Never \
Expand Down
45 changes: 44 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,17 @@ jobs:
runs-on: ubuntu-latest
environment: release
steps:
- name: Generate app token
id: app-token
uses: actions/create-github-app-token@v3
with:
client-id: ${{ secrets.RELEASE_APP_CLIENT_ID }}
private-key: ${{ secrets.RELEASE_APP_PRIVATE_KEY }}

- uses: actions/checkout@v6
with:
fetch-depth: 0
token: ${{ steps.app-token.outputs.token }}

- name: Configure git identity
run: |
Expand Down Expand Up @@ -99,6 +107,41 @@ jobs:
if: ${{ inputs.dry_run == false }}
run: git push --follow-tags

docs:
name: Deploy Release Docs
needs: release
if: ${{ inputs.dry_run == false }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
ref: main
fetch-depth: 0

- name: Extract version from latest tag
id: version
run: |
VERSION=$(git tag -l 'lldap-operator@v*' \
| sed 's/lldap-operator@//' \
| sort -t. -k1,1rn -k2,2rn -k3,3rn \
| head -1)
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
echo "Detected version: $VERSION"

- name: Trigger docs deployment
uses: actions/github-script@v7
with:
script: |
await github.rest.actions.createWorkflowDispatch({
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: 'deploy-docs.yml',
ref: 'main',
inputs: {
version: '${{ steps.version.outputs.version }}'
}
});

docker:
name: Build and Push Docker Image
needs: release
Expand All @@ -123,7 +166,7 @@ jobs:
id: version
run: |
VERSION=$(cargo metadata --format-version=1 --no-deps \
| jq -r '.packages[] | select(.name=="lldap-resources-operator") | .version')
| jq -r '.packages[] | select(.name=="lldap-operator") | .version')
echo "version=$VERSION" >> "$GITHUB_OUTPUT"

- uses: docker/build-push-action@v6
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,6 @@ $RECYCLE.BIN/
# Added by cargo

/target

# mdBook build output
docs/book/
32 changes: 32 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Contributing to lldap-operator

Thank you for your interest in contributing!

## Documentation

The project documentation is built with [mdBook](https://rust-lang.github.io/mdBook/).
The published version is available at
<https://lukidoescode.github.io/lldap-operator/>.

To build and preview locally:

```bash
cargo install mdbook
cd docs
mdbook serve
```

See the [Architecture](https://lukidoescode.github.io/lldap-operator/architecture.html)
chapter for an overview of the codebase structure and the
[Development Guide](https://lukidoescode.github.io/lldap-operator/development.html)
for build instructions and local setup.

## Reporting Issues

Please file issues on the
[GitHub issue tracker](https://github.com/lukidoescode/lldap-operator/issues).

## License

By contributing, you agree that your contributions will be licensed under the
[MIT License](LICENSE).
14 changes: 7 additions & 7 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading