diff --git a/.github/workflows/manual-deploy.yaml b/.github/workflows/manual-deploy.yaml deleted file mode 100644 index 0162f44b..00000000 --- a/.github/workflows/manual-deploy.yaml +++ /dev/null @@ -1,59 +0,0 @@ -name: Manual Deployment -on: - workflow_dispatch: - inputs: - version: - description: 'The version to deploy' - required: true - default: '0.7.0' - sourceBranch: - description: 'Source Branch' - required: true - default: '0.7.x' - -jobs: - deploy: - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v2 - with: - fetch-depth: 0 # Fetches all history for all branches and tags - ref: ${{ github.event.inputs.sourceBranch }} - - - name: Setup Python - uses: actions/setup-python@v2 - with: - python-version: '3.x' - - - name: Install Requirements - run: pip install -r requirements.txt - - - name: Validate User Permissions - id: validate_user - run: | - USER_PERMISSION=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ - "https://api.github.com/repos/${{ github.repository }}/collaborators/${{ github.actor }}/permission") - echo "User permissions: $USER_PERMISSION" - if [[ "$USER_PERMISSION" =~ (\"permission\": \"admin\") ]]; then - echo "User is authorized to deploy." - echo "::set-output name=can_deploy::true" - else - echo "::error::User is not authorized to deploy." - echo "::set-output name=can_deploy::false" - fi - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Setup Git Config - if: steps.validate_user.outputs.can_deploy == 'true' - run: | - git config --global user.name "Docs Deploy" - git config --global user.email "kuadrant@googlegroups.com" - - - name: Deploy Documentation - if: steps.validate_user.outputs.can_deploy == 'true' - run: | - mike deploy ${{ github.event.inputs.version }} -t "${{ github.event.inputs.version }}" --push - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/mike.yaml b/.github/workflows/mike.yaml deleted file mode 100644 index f96d7bb2..00000000 --- a/.github/workflows/mike.yaml +++ /dev/null @@ -1,75 +0,0 @@ -name: Mike Deployment Trigger - -on: - issue_comment: - types: [created] - -jobs: - handle_comment: - runs-on: ubuntu-latest - if: startsWith(github.event.comment.body, '/mike deploy') || startsWith(github.event.comment.body, '/mike help') - steps: - - name: Checkout Repo - uses: actions/checkout@v3 - with: - fetch-depth: 0 # Fetches all history for all branches and tags - - - name: Setup Python - uses: actions/setup-python@v4 - if: startsWith(github.event.comment.body, '/mike deploy') - with: - python-version: 3.x - - - name: Install Requirements - run: pip install -r requirements.txt - if: startsWith(github.event.comment.body, '/mike deploy') - - - name: Validate User - id: validate_user - run: | - USER_PERMISSION=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ - "https://api.github.com/repos/${{ github.repository }}/collaborators/${{ github.actor }}/permission") - echo "User permissions: $USER_PERMISSION" - if [[ "$USER_PERMISSION" =~ (\"permission\": \"admin\") ]]; then - echo "User is authorized to deploy." - echo "::set-output name=can_deploy::true" - else - echo "::error::User is not authorized to deploy." - echo "::set-output name=can_deploy::false" - fi - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Setup Git Config - if: env.can_deploy == 'true' - run: | - git config --global user.name "Docs Deploy" - git config --global user.email "kuadrant@googlegroups.com" - - - name: Deploy Docs - if: env.can_deploy == 'true' - run: | - VERSION=$(echo "${{ github.event.comment.body }}" | cut -d " " -f 3) - BRANCH=$(echo "${{ github.event.comment.body }}" | awk -F'sourceBranch=' '{print $2}') - mike deploy $VERSION -t "$VERSION" --push --branch $BRANCH - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Comment Deployment Status - if: steps.validate_user.outputs.can_deploy == 'true' - run: | - VERSION=$(echo "${{ github.event.comment.body }}" | cut -d " " -f 3) - echo "Deployed $VERSION to https://docs.kuadrant.io/$VERSION" > comment.md - gh issue comment ${{ github.event.issue.number }} --body "$(cat comment.md)" - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Provide Help - if: startsWith(github.event.comment.body, '/mike help') - run: | - echo "To deploy documentation using mike, use the command format:" > comment.md - echo "/mike deploy [version] sourceBranch=[branch]" >> comment.md - echo "Example: /mike deploy 0.7.0 sourceBranch=0.7.x" >> comment.md - gh issue comment ${{ github.event.issue.number }} --body "$(cat comment.md)" - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/README.md b/README.md index 69369418..1cf8cad4 100644 --- a/README.md +++ b/README.md @@ -16,14 +16,16 @@ If you'd like to test multi-versioning, run locally with the `mike` equivalent: `mike serve` +This will serve docs directly from the `gh-pages` branch, with multi-versioning. For general local development and testing of changes, you probably want `mkdocs serve`. + **Note:** `mkdocs` will automatically clone component repositories as configured via `mkdocs.yml`. ## Building -See `.github/workflows/build.yaml` +See `.github/workflows/build.yaml` & `.github/workflows/manual-deploy.yaml` ## `mike` -We use `mike` for multi-versioned docs. It's quite straight-forward: it works by adding new commits to the `gh-pages` branch each time you run `mike deploy`. It takes care of setting up the aliases, and leaves previously "deployed" docs untouched, in their old folders. These old deployments shouldn't be touched, but can be re-built if necessary. +We use `mike` for multi-versioned docs. It's quite straight-forward: it works by adding new commits to the `gh-pages` branch each time you run `mike deploy`. It takes care of setting up the aliases, and leaves previously "deployed" docs untouched, in their old folders. These old deployments ideally shouldn't be touched, but can be re-built if necessary. Some useful commands: @@ -58,6 +60,8 @@ Stable releases should be tagged (e.g. `git tag 0.6.1`). ### Stable releases: +This describes the manual steps needed to create a new release and mark that as stable. + A scenario: - 0.6.1 was the stable release @@ -101,6 +105,21 @@ To mark this new release as stable: Generally not advised given how `mike` works, but if you need to patch an existing release (in this example, `0.7.0`): +### Via CI (recommended) +To re-release docs via CI: + +- Go to `Actions` -> `Re-deploy via mike` -> `Run Workflow` + - For version to deploy, pick an existing version (e.g. `0.7.0`) + - For source branch, pick a release branch (e.g. `0.7.x`) or `main` + - This will: + - Checkout your source branch + - Build your docs (new changes will be pulled in via git-refs in `mkdocs.yml`) + - And run the equivalent of `mike deploy 0.7.0 -t "0.7.0" --push` + +### Manually + +To do this manually: + - Fetch: `git fetch --all` (need latest gh-pages branch) - Check out the release branch:`git checkout 0.7.x` - Make your changes @@ -123,6 +142,9 @@ Generally not advised given how `mike` works, but if you need to patch an existi - Delete and re-tag + + + ## Deploying This is deployed via GitHub Pages, on merge to `main`.