Update api spec (#104) #65
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/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@v4 | |
- uses: actions/setup-go@v4 | |
with: | |
go-version: '1.19.x' | |
- name: make generate | |
shell: bash | |
run: | | |
make generate | |
# Ensure no files changed. | |
- name: Ensure no files changed | |
shell: bash | |
run: | | |
if [[ `git status --porcelain` ]]; 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@v4 | |
with: | |
repository: 'kittycad/website' | |
path: 'website' | |
token: ${{secrets.PAT_GITHUB}} | |
- name: move spec to docs | |
shell: bash | |
run: | | |
rm website/kittycad.go.patch.json || true | |
cp kittycad.go.patch.json website/kittycad.go.patch.json | |
- name: commit the changes in the website repo | |
shell: bash | |
run: | | |
export VERSION=$(cat VERSION.txt); | |
cd website | |
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 GO SPEC DOCS ${VERSION}!" || exit 0 | |
git fetch origin | |
git rebase origin/main || exit 0 | |
export NEW_BRANCH="update-spec-go" | |
git checkout -b "$NEW_BRANCH" | |
git push -f origin "$NEW_BRANCH" | |
gh pr create --title "Update go lang spec docs for ${VERSION}" \ | |
--body "Updating the generated docs for go lang" \ | |
--head "$NEW_BRANCH" \ | |
--base main || true | |
env: | |
GITHUB_TOKEN: ${{secrets.PAT_GITHUB}} | |