fixes #130
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: | |
push: | |
tags: | |
- v* | |
pull_request: | |
paths: | |
- .github/workflows/generate-website-docs.yml | |
workflow_dispatch: | |
name: generate-website-docs | |
concurrency: | |
group: docs-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
generate-website-docs: | |
name: make-release | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install latest rust | |
uses: dtolnay/rust-toolchain@stable | |
- name: Cache cargo registry | |
uses: actions/cache@v4 | |
with: | |
path: ~/.cargo/registry | |
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} | |
- name: Cache cargo index | |
uses: actions/cache@v4 | |
with: | |
path: ~/.cargo/git | |
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }} | |
- name: Cache cargo build | |
uses: actions/cache@v4 | |
with: | |
path: target | |
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }} | |
- name: install toml-cli | |
shell: bash | |
run: | | |
cargo install toml-cli | |
- name: make gen-md | |
shell: bash | |
run: | | |
make gen-md | |
- uses: actions/create-github-app-token@v1 | |
id: app-token | |
with: | |
# required | |
app-id: ${{ secrets.GH_ORG_APP_ID }} | |
private-key: ${{ secrets.GH_ORG_APP_PRIVATE_KEY }} | |
owner: ${{ github.repository_owner }} | |
# Checkout the docs repo since we will want to update the files there. | |
- uses: actions/checkout@v4 | |
with: | |
repository: 'kittycad/documentation' | |
path: 'docs' | |
token: ${{ steps.app-token.outputs.token }} | |
- name: move docs to docs | |
shell: bash | |
run: | | |
# cleanup old | |
rm -rf docs/content/pages/docs/cli/manual/kittycad*.md | |
rm -rf docs/content/pages/docs/cli/manual/zoo*.md | |
# move new | |
mv -f generated_docs/md/zoo*.md docs/content/pages/docs/cli/manual/ | |
- name: commit the changes in the docs repo | |
shell: bash | |
run: | | |
export VERSION=$(toml get Cargo.toml package.version | jq -r .); | |
cd docs | |
git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
git config --local user.name "github-actions[bot]" | |
git add . | |
git commit -am "YOYO NEW CLI DOCS FOR ${VERSION}!" || exit 0 | |
git fetch origin | |
git rebase origin/main || exit 0 | |
export NEW_BRANCH="update-docs-${VERSION}" | |
git checkout -b "$NEW_BRANCH" | |
git push -f origin "$NEW_BRANCH" | |
gh pr create --title "Update CLI docs for ${VERSION}" \ | |
--body "Updating the generated cli docs" \ | |
--head "$NEW_BRANCH" \ | |
--reviewer jessfraz \ | |
--reviewer irev-dev \ | |
--reviewer franknoirot \ | |
--base main || true | |
env: | |
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }} | |