try this #6
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: "Gradle Tasks" | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
schedule: | |
# ensures that workflow runs AT LEAST every 60 days to keep artifacts downloadable | |
- cron: "0 3 15 */2 *" | |
workflow_dispatch: | |
jobs: | |
build: | |
# - setup java | |
# - setup gradle cache | |
# - setup android sdk | |
runs-on: "ubuntu-latest" | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: '21' | |
cache: 'gradle' | |
# we don't need to declare any additional cache paths, the cache already catches everything | |
- uses: android-actions/setup-android@v3 | |
- run: "chmod +x ./gradlew" # this project is used from windows, so it can be messed up | |
- run: "./gradlew build javaDocReleaseJar releaseSourcesJar --no-daemon" | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: "gradle-artifacts" | |
path: | | |
**/build/outputs/**/*.aar | |
**/build/outputs/**/*.apk | |
**/build/outputs/**/*.jar | |
**/build/libs/**/*.jar | |
**/build/intermediates/java_doc_jar/release/release-javadoc.jar | |
javadoc: | |
if: github.event_name == 'push' && github.ref == 'refs/heads/master' | |
runs-on: "ubuntu-latest" | |
needs: build | |
steps: | |
# - download the javadoc artifact | |
# - extract the javadoc artifact to /tmp | |
# - setup folders like common/, compose/, ble/, for modules in javadocs | |
# - copy the javadoc files to the correct folders | |
# - use actions/deploy-pages to deploy the javadoc to gh-pages | |
- uses: actions/download-artifact@v4 | |
with: | |
name: "gradle-artifacts" | |
path: "./artifact" | |
- name: "isolate javadocs" | |
run: | | |
mkdir -p /tmp/javadoc | |
mkdir -p /tmp/javadoc/common | |
mkdir -p /tmp/javadoc/compose | |
mkdir -p /tmp/javadoc/ble | |
unzip -o ./artifact/compose/build/intermediates/java_doc_jar/release/release-javadoc.jar -d /tmp/javadoc/compose | |
unzip -o ./artifact/ble/build/intermediates/java_doc_jar/release/release-javadoc.jar -d /tmp/javadoc/ble | |
unzip -o ./artifact/common/build/intermediates/java_doc_jar/release/release-javadoc.jar -d /tmp/javadoc/common | |
- name: "deploy javadocs" | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: "/tmp/javadoc" |