68 lines
2.0 KiB
YAML
68 lines
2.0 KiB
YAML
on:
|
|
push:
|
|
tags:
|
|
- v*
|
|
pull_request:
|
|
paths:
|
|
- .github/workflows/update-spec-for-docs.yml
|
|
workflow_dispatch:
|
|
name: update spec for docs
|
|
concurrency:
|
|
group: docs-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
jobs:
|
|
update-spec:
|
|
name: update-spec
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- name: make generate
|
|
shell: bash
|
|
run: |
|
|
make generate
|
|
env:
|
|
KITTYCAD_API_TOKEN: ${{secrets.KITTYCAD_API_TOKEN}}
|
|
# Ensure no files changed.
|
|
- name: Ensure no files changed
|
|
shell: bash
|
|
run: |
|
|
if [[ `git status --porcelain kittycad/` ]]; then
|
|
echo "Files changed, exiting";
|
|
exit 1;
|
|
else
|
|
# No changes
|
|
echo "No files changed, proceeding";
|
|
fi
|
|
# Checkout the docs repo since we will want to update the files there.
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
repository: 'kittycad/website'
|
|
path: 'docs'
|
|
token: ${{secrets.PAT_GITHUB}}
|
|
- name: move spec to docs
|
|
shell: bash
|
|
run: |
|
|
rm docs/kittycad.py.patch.json || true
|
|
cp kittycad.py.patch.json docs/kittycad.py.patch.json
|
|
- name: commit the changes in the docs repo
|
|
shell: bash
|
|
run: |
|
|
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 SPEC PYTHON DOCS!" || exit 0
|
|
git fetch origin
|
|
git rebase origin/main || exit 0
|
|
export NEW_BRANCH="update-spec-python"
|
|
git checkout -b "$NEW_BRANCH"
|
|
git push -f origin "$NEW_BRANCH"
|
|
gh pr create --title "Update lang spec docs for python" \
|
|
--body "Updating the generated docs for python" \
|
|
--head "$NEW_BRANCH" \
|
|
--base main || true
|
|
env:
|
|
GITHUB_TOKEN: ${{secrets.PAT_GITHUB}}
|
|
|
|
|