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

docs: backend config and user import schema and markdown generation improvements #1582

Merged
merged 5 commits into from
Aug 26, 2024

Conversation

lfleischmann
Copy link
Member

@lfleischmann lfleischmann commented Aug 19, 2024

Description

Cleans up the config, moves evertyhing JSON schema related to their own cmds, provides CI workflows for automation.

Implementation

Config.go changes:

  • Split main config.go into files based on top level config properties.

New commands:

  • schema generate config - Generates JSON schema for the backend config
  • schema generate import - Generates JSON schema for the user import/export
  • schema markdown config - Generates markdown for the backend config
  • schema markdown import - Generates markdown for the user import/export

New workflows:

  • .github/workflows/schema-generate-config.yml and ./.github/workflows/schema-generate-import.yml - On every push to the main branch, if the backend/config.go/backend/cmd/user/format.go file has been changed:
    • generates the JSON schema for the backend config/user import/export and commits and pushes it to the repo.
  • ./.github/workflows/schema-markdown-import.yml and ./.github/workflows/schema-markdown-config.yml - On every backend/* tag:
    • generates the markdown for the backend config/user import/export
    • removes .md file endings from links inside generated .md files (because the GitHub Wiki cannot handle those links)
    • adds a Version markdown section to all generated .md files based on the semver contained in the tag that triggered the workflow
    • commits and pushes changes to the main repos Wiki repo
    • provides a manual workflow_dispatch in case we might want rollback the docs in the wiki to an earlier version

How to test

To test the workflows either:

  • Try to make it work with act somehow - did not work out for me this time, mainly because I simply could not download the runner image (just stopped after a certain amount of time).
  • Do the following:
    1. Fork the hanko repo, uncheck the box for forking only the main branch.
    2. In your fork: remove or set all workflows to workflow_dispatch(i.e. replace everything under the on with workflow_dispatch:) and commit.
    3. Go to the fork's Settings > Features section, make sure Wiki is enabled.
    4. Navigate to the Wiki and create a first page, contents are irrelevant at this point. This is necessary because the Wiki repo is not available before adding a page.
    5. Merge the PR branch doc-generation-improvements into main.
    6. schema-generate-config and schema-generate-import workflows should already run at this point because the PR contains changes to the files/file paths "watched" by the workflow. Make further changes to the files in order to trigger the flows.
    7. Tag the backend (e.g. backend/v1.1.0), the other two workflows should run. They do not push to the Wiki if no changes are detected.

@lfleischmann lfleischmann marked this pull request as ready for review August 19, 2024 15:10
@lfleischmann lfleischmann merged commit 5f6bebb into main Aug 26, 2024
9 checks passed
@lfleischmann lfleischmann deleted the doc-generation-improvements branch August 26, 2024 12:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants