Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
haydenbaker committed Feb 20, 2024
1 parent ac92561 commit 529a4b3
Showing 1 changed file with 87 additions and 0 deletions.
87 changes: 87 additions & 0 deletions .github/workflows/make-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: make-docs
on:
release:
types: [released]
workflow_dispatch: # on button click
inputs:
javadocs:
type: boolean
description: 'Build JavaDocs?'
required: true
release:
type: boolean
description: 'Release the docs?'
required: true

env:
ARTIFACTS_DIR: /tmp/artifacts

jobs:
build-docs:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Setup
run: |
mkdir -p $ARTIFACTS_DIR
- name: Build JavaDocs
# run if 'javadocs' is not set to false
if: ${{ !contains(inputs.javadocs, 'false') }}
run: |
VERSION=$(cat VERSION)
mkdir -p $ARTIFACTS_DIR/javadoc
./gradlew javadoc
cp -R build/docs/javadoc/latest $ARTIFACTS_DIR/javadoc/$VERSION
mkdir $ARTIFACTS_DIR/javadoc/latest
cat << EOF > $ARTIFACTS_DIR/javadoc/latest/index.html
<!DOCTYPE html>
<meta charset="utf-8">
<title>Redirecting to latest javadocs</title>
<meta http-equiv="refresh" content="0; URL=../${VERSION}/">
EOF
- name: Build Smithy docs
run: |
cd docs
pip3 install -r requirements.txt
make clean
make html
cp -R build/html/* $ARTIFACTS_DIR
rm $ARTIFACTS_DIR/.buildinfo || true
rm $ARTIFACTS_DIR/objects.inv || true
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: smithy-docs
path: ${{ env.ARTIFACTS_DIR }}
retention-days: 7


publish-docs:
runs-on: ubuntu-latest
# run if 'release' is not set to false
if: ${{ !contains(inputs.release, 'false') }}
needs: build-docs
steps:
- name: Checkout GitHub pages branch
uses: actions/checkout@v4
with:
ref: 'gh-pages'
- name: Download artifacts
id: download
uses: actions/download-artifact@v4
with:
name: smithy-docs
path: /tmp/smithy-docs
- name: Copy artifacts
run: |
cp -R /tmp/smithy-docs/* .
git config --global user.name "smithy-automation"
git config --global user.email "[email protected]"
git add -A
git commit -m "Update documentation"
git push

0 comments on commit 529a4b3

Please sign in to comment.