Generate Docs π #10
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 Docs π | |
on: | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Setup JDK 17 | |
uses: actions/setup-java@v2 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
cache: gradle | |
- name: Make gradlew executable | |
run: chmod +x gradlew | |
- name: Decode google-services.json | |
env: | |
GOOGLE_SERVICES_JSON: ${{ secrets.APP_GOOGLE_JSON }} | |
run: echo $GOOGLE_SERVICES_JSON > ./bitapp/google-services.json | |
- name: Creating Local.Properties | |
env: | |
FIREBASE_WEB_CLIENT_ID: ${{ secrets.FIREBASE_WEB_CLIENT_ID }} | |
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }} | |
run: | | |
echo "firebaseWebClient=${FIREBASE_WEB_CLIENT_ID}" >> ./local.properties | |
echo "apiKey=${GEMINI_API_KEY}" >> ./local.properties | |
- name: Generate Dokka docs | |
run: ./gradlew dokkaHtmlMultiModule | |
- name: Upload Kt docs | |
uses: actions/upload-artifact@v2 | |
with: | |
name: kt-docs | |
path: build/dokka | |
retention-days: 1 | |
- name: Uploading mk-docs | |
uses: actions/upload-artifact@v2 | |
with: | |
name: mk-docs | |
path: mk-docs | |
retention-days: 1 | |
setting-up: | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Download docs | |
uses: actions/download-artifact@v3 | |
with: | |
name: kt-docs | |
- name: Download MkDocs | |
uses: actions/download-artifact@v3 | |
with: | |
name: mk-docs | |
- name: Copy docs | |
run: | | |
ls -la | |
mkdir -p copyDoc/generated | |
cp mkdocs.yml copyDoc/generated | |
mkdir -p copyDoc/generated/docs | |
cp -r docs/* copyDoc/generated/docs | |
ls -la copyDoc/generated/docs | |
mkdir -p copyDoc/generated/docs/app | |
cp -r htmlMultiModule/* copyDoc/generated/docs/app | |
ls -la copyDoc/generated/docs/app | |
- name: Upload docs | |
uses: actions/upload-artifact@v2 | |
with: | |
name: generated-docs | |
path: copyDoc | |
retention-days: 1 | |
deploy: | |
runs-on: ubuntu-latest | |
needs: setting-up | |
permissions: write-all | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Configure Git Credentials | |
run: | | |
git config user.name github-actions[bot] | |
git config user.email 41898282+github-actions[bot]@users.noreply.github.com | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.x' | |
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV | |
- uses: actions/cache@v3 | |
with: | |
key: mkdocs-material-${{ env.cache_id }} | |
path: .cache | |
restore-keys: | | |
mkdocs-material- | |
- name: Download docs | |
uses: actions/download-artifact@v3 | |
with: | |
name: generated-docs | |
- uses: joutvhu/get-release@v1 | |
id: latest_release | |
with: | |
latest: true | |
pattern: 'v.+' | |
prerelease: false | |
env: | |
GITHUB_TOKEN: ${{ secrets.ACCOUNT_TOKEN }} | |
- uses: joutvhu/get-release@v1 | |
id: pre_release | |
with: | |
latest: true | |
pattern: 'pre.+' | |
prerelease: true | |
env: | |
GITHUB_TOKEN: ${{ secrets.ACCOUNT_TOKEN }} | |
- run: | | |
cd generated | |
sed -i -E 's/stable.+/stable: ${{ steps.latest_release.outputs.tag_name }}/' mkdocs.yml | |
sed -i -E "s/pre_release.+/pre_release: $(echo ${{ steps.pre_release.outputs.tag_name }} | cut -c 13-) /" mkdocs.yml | |
echo "stable: ${{ github.event.inputs.stable }}" | |
echo "pre_release: ${{ github.event.inputs.pre_release }}" | |
pip install mkdocs-material | |
pip install mkdocs-glightbox | |
pip install mkdocs-markdownextradata-plugin | |
- run: | | |
cd generated | |
mkdocs gh-deploy --force | |