Fix: Add timeout and gradle config for Android build #3
This file contains hidden or 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: Build and Deploy | |
| on: | |
| push: | |
| branches: [ main, elizaos-challenge ] | |
| workflow_dispatch: | |
| env: | |
| DOCKER_IMAGE: ${{ secrets.DOCKER_USERNAME }}/miku | |
| NOSANA_API_KEY: ${{ secrets.NOSANA_API_KEY }} | |
| jobs: | |
| build-android: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '17' | |
| distribution: 'temurin' | |
| - name: Make gradlew executable | |
| working-directory: ./android | |
| run: chmod +x gradlew | |
| - name: Setup Gradle | |
| uses: gradle/gradle-build-action@v3 | |
| with: | |
| gradle-version: 8.9 | |
| - name: Build Android APK | |
| working-directory: ./android | |
| run: ./gradlew assembleRelease --no-daemon --stacktrace | |
| - name: Upload APK Artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: android-apk | |
| path: android/app/build/outputs/apk/release/app-release.apk | |
| - name: Create Release | |
| if: github.ref == 'refs/heads/main' | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| tag_name: v${{ github.run_number }} | |
| name: Release v${{ github.run_number }} | |
| files: android/app/build/outputs/apk/release/app-release.apk | |
| generate_release_notes: true | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| build-and-deploy-agent: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKER_USERNAME }} | |
| password: ${{ secrets.DOCKER_PASSWORD }} | |
| - name: Build and push Docker image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| push: true | |
| tags: | | |
| ${{ env.DOCKER_IMAGE }}:latest | |
| ${{ env.DOCKER_IMAGE }}:${{ github.sha }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| - name: Install Nosana CLI | |
| run: npm install -g @nosana/cli | |
| - name: Deploy to Nosana | |
| run: | | |
| nosana job post \ | |
| --file ./nos_job_def/nosana_eliza_job_definition.json \ | |
| --market nvidia-3090 \ | |
| --timeout 300 \ | |
| --api ${{ env.NOSANA_API_KEY }} |