Versioned Docs #69
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: Versioned Docs | |
on: | |
workflow_dispatch: | |
push: | |
tags: | |
- '[0-9]+.[0-9]+.[0-9]+' | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.ref != 'refs/heads/main' || github.run_number }} | |
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull') }} | |
jobs: | |
docs: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: "main" | |
path: main | |
- uses: actions/checkout@v3 | |
with: | |
ref: docs | |
path: docs | |
- uses: actions/setup-java@v3 | |
with: | |
distribution: zulu | |
java-version: 17 | |
- name: Generate docs | |
env: | |
STYTCH_PUBLIC_TOKEN: 'abc123' | |
GOOGLE_OAUTH_CLIENT_ID: 'abc123' | |
STYTCH_B2B_PUBLIC_TOKEN: 'abc123' | |
STYTCH_B2B_ORG_ID: 'abc123' | |
PASSKEYS_DOMAIN: 'abc123' | |
STYTCH_UI_PUBLIC_TOKEN: 'abc123' | |
UI_GOOGLE_CLIENT_ID: 'abc123' | |
working-directory: main | |
run: ./gradlew dokkaHtmlMultiModule | |
- name: Zip docs site | |
run: | | |
cd main/docs | |
zip -r ../../Docs.zip . | |
cd - | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: "main" | |
path: Docs.zip | |
publish: | |
needs: [docs] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: main | |
path: main | |
- uses: actions/checkout@v3 | |
with: | |
ref: docs | |
path: docs | |
- uses: actions/download-artifact@v3 | |
with: | |
path: artifacts | |
- name: Unzip | |
run: | | |
mkdir unzipped-docs | |
unzipped_path="unzipped-docs/main" | |
mkdir -p "$unzipped_path" | |
unzip "artifacts/main/Docs.zip" -d "$unzipped_path" | |
echo "extracting to root" | |
rsync -a "$unzipped_path/" docs/docs | |
- name: Update git config | |
working-directory: docs | |
run: | | |
git config --local user.name "CI" | |
git config --local user.email "ci@stytch.com" | |
- name: Commit | |
working-directory: main | |
run: | | |
current_sha="$(git rev-parse @)" | |
cd ../docs | |
if [[ -z $(git status --porcelain) ]]; then exit 0; fi | |
git add --all | |
git commit -m "$current_sha" | |
git push |