Skip to content

docs: Update README.md to include PR builder status #14

docs: Update README.md to include PR builder status

docs: Update README.md to include PR builder status #14

Workflow file for this run

# -------------------------------------------------------------------------------------
#
# Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com).
#
# WSO2 LLC. licenses this file to you under the Apache License,
# Version 2.0 (the "License"); you may not use this file except
# in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
# --------------------------------------------------------------------------------------
# This workflow will run the build for PRs to check for any build related issues.
name: 👷 PR Builder
on:
pull_request:
types: [ opened, synchronize, labeled ]
branches: [ main ]
paths-ignore:
- "**/LICENSE"
concurrency:
group: pr-builder-${{ github.ref }}
cancel-in-progress: true
env:
ANDROID_SCRIPT_DIR: .github/workflows/scripts/android
DOCS_SCRIPT_DIR: .github/workflows/scripts/docs
DOC_DIR: docs
jobs:
check_for_relevant_changes:
name: 🔄 Check for Relevant Changes
runs-on: ubuntu-latest
outputs:
android_changed: ${{ steps.check_android_changes.outputs.android_changed }}
documentation_changed: ${{ steps.check_documentation_changes.outputs.documentation_changed }}
steps:
- name: ⬇️ Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: 🌴 Fetch PR branch
run: |
if [ ${{ github.event.pull_request.head.repo.fork }} == true ]; then
git fetch origin pull/${{ github.event.pull_request.number }}/head:pr-${{ github.event.pull_request.number }}
else
git fetch origin ${{ github.head_ref }}
fi
- name: 🗃️ Get changed files
id: changed-files
run: |
if [ ${{ github.event.pull_request.head.repo.fork }} == true ]; then
echo "Comparing changes for PR from fork"
git diff --name-only origin/${{ github.base_ref }}..pr-${{ github.event.pull_request.number }} > changed_files.txt
else
echo "Comparing changes for internal PR"
git diff --name-only origin/${{ github.base_ref }}..origin/${{ github.head_ref }} > changed_files.txt
fi
echo "Changed files:"
cat changed_files.txt
- name: 🤖 Check for Android Changes
id: check_android_changes
run: |
echo "Checking for Android changes"
android_changed=false
if grep -q "android/" changed_files.txt; then
android_changed=true
echo "Android changes detected"
fi
echo "android_changed=${android_changed}" >> $GITHUB_OUTPUT
- name: 📑 Check for Documentation Changes
id: check_documentation_changes
run: |
echo "Checking for Documentation changes"
documentation_changed=false
if grep -q "docs/" changed_files.txt; then
documentation_changed=true
echo "Documentation changes detected"
fi
echo "documentation_changed=${documentation_changed}" >> $GITHUB_OUTPUT
asgardeo-android-sdk-builder:
name: 🤖 🚧 Asgardeo Android SDK Builder
needs: check_for_relevant_changes
if: needs.check_for_relevant_changes.outputs.android_changed == 'true'
runs-on: ubuntu-latest
steps:
- name: ⬇️ Checkout
id: checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: ☕️ Set up Adopt JDK 17
uses: actions/setup-java@v3
with:
java-version: "17"
distribution: "adopt"
- name: 🚧 Build Asgardeo Android SDK
working-directory: ${{ env.ANDROID_SCRIPT_DIR }}
run: bash ./android_sdk_build.sh
documentation-builder:
name: 📑 🚧 Documentation Builder
needs: check_for_relevant_changes
if: needs.check_for_relevant_changes.outputs.documentation_changed == 'true'
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [lts/*]
steps:
- name: ⬇️ Checkout
id: checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: 🟢 Setup node
id: setup-node
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- name: 🧩 Install Dependencies
id: install-dependencies
working-directory: ${{ env.DOC_DIR }}
run: npm ci
- name: 🏗️ Build with VitePress
id: build
working-directory: ${{ env.DOC_DIR }}
run: |
npm run docs:build
- name: ☕️ Set up Adopt JDK 17 (For Android SDK API Docs Generation)
uses: actions/setup-java@v3
with:
java-version: "17"
distribution: "adopt"
- name: 🤖 Generate Android SDK API Docs
working-directory: ${{ env.DOCS_SCRIPT_DIR }}/android
run: bash ./dokka_build.sh