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

feat: automate publishing docs #593

Merged
merged 2 commits into from
Dec 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 13 additions & 8 deletions .github/workflows/gen-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,22 @@

# Generate documentation for apigeecli
name: apigeecli Github Pages Pipeline

permissions: read-all
on:
#push:
# Publish semver tags as releases.
# tags:
# - v[0-9].[0-9]+.[0-9]
push:
# Publish semver tags as releases.
tags:
- v[0-9].[0-9]+.[0-9]
workflow_dispatch:

jobs:
publish-gh-pages:
name: Publish apigeecli Documentation
runs-on: ubuntu-latest
permissions:
contents: write # needed to create PR
packages: write

steps:
- name: Checkout Code
uses: actions/checkout@1e31de5234b9f8995739874a8ce0492dc87873e2 #v4
Expand All @@ -36,8 +40,8 @@ jobs:
git config --global user.name "$(git log -n 1 --pretty=format:%an)"
git config --global user.email "$(git log -n 1 --pretty=format:%ae)"

git pull origin main --allow-unrelated-histories
git checkout -b docs_$SHORT_SHA
git checkout gh_pages
git reset --hard origin/main

GOBIN=/tmp/ go install github.com/google/[email protected]
/tmp/go-licenses csv ./cmd/apigeecli > third-party-licenses.txt || echo "Ignore warnings"
Expand All @@ -50,4 +54,5 @@ jobs:

git add --all
git commit -m "Update GH Pages - $SHORT_SHA" || echo "No Changes in docs"
git push origin docs_$SHORT_SHA
git push origin gh_pages
gh pr create --title "Update Documentation" --body "update docs to ${GITHUB_SHA}" --base main --head docs
Loading