Merge branch 'main' into wip #11
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
name: Generate Documentation Preview | |
on: | |
pull_request: | |
branches: | |
- "*" | |
push: | |
branches: | |
- "*" | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v2 | |
- name: Set up Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: "1.21" | |
- name: Install godoc | |
run: go install -v golang.org/x/tools/cmd/godoc@latest | |
- name: Generate Documentation | |
run: | | |
godoc -http=:6060 & sleep 5 | |
# Generate the documentation | |
mkdir -p _generated_documentation | |
curl -sSf http://localhost:6060/pkg/ > _generated_documentation/index.html | |
- name: Upload Documentation Preview | |
uses: actions/upload-artifact@v2 | |
with: | |
name: documentation-preview | |
path: _generated_documentation | |
deploy: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download Documentation Preview | |
uses: actions/download-artifact@v2 | |
with: | |
name: documentation-preview | |
path: _generated_documentation | |
- name: Deploy Documentation Preview | |
run: | | |
# Deploy the generated documentation preview to the gh-pages branch | |
git clone --branch=gh-pages --single-branch https://github.com/${{ github.repository }}.git gh-pages | |
cp -r _generated_documentation/* docs | |
cd gh-pages | |
git config user.name "${{ github.actor }}" | |
git config user.email "${{ github.actor }}@users.noreply.github.com" | |
git add . | |
git commit -m "Update documentation preview" | |
git push origin gh-pages |