Merge pull request #136 from guardian/expose-image-resources #59
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: Android Docs | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
changes: | |
name: Check for Android changes | |
runs-on: ubuntu-latest | |
if: github.repository == 'guardian/source-apps' | |
permissions: | |
pull-requests: read | |
outputs: | |
android: ${{ steps.filter.outputs.android }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dorny/paths-filter@v3 | |
id: filter | |
with: | |
filters: | | |
android: | |
- 'android/**' | |
- '.github/**' | |
docs: | |
name: Generate Android docs | |
runs-on: ubuntu-latest | |
needs: changes | |
if: ${{ needs.changes.outputs.android == 'true' && github.repository == 'guardian/source-apps' }} | |
permissions: write-all | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@v3 | |
- name: Build and commit docs | |
run: | | |
cd android | |
./gradlew :source:dokkaHtml --no-configuration-cache --rerun-tasks | |
git config --global user.name "GuardianAndroid" | |
git config --global user.email "[email protected]" | |
git fetch origin gh-pages | |
git checkout gh-pages | |
git pull origin gh-pages | |
rm -rf docs | |
mkdir -p docs | |
mv source/build/dokka/html/* docs/ | |
git add docs | |
git diff --staged --quiet || git commit -m "Update docs" -- docs | |
git push origin gh-pages --set-upstream | |