ci: add release build for client and DockerHub push for server #2
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: Android CI | |
| on: | |
| push: | |
| branches: [ main ] | |
| tags: | |
| - 'v*' | |
| paths: | |
| - 'client/**' | |
| - '.github/workflows/client.yml' | |
| pull_request: | |
| branches: [ main ] | |
| paths: | |
| - 'client/**' | |
| - '.github/workflows/client.yml' | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: client | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '17' | |
| distribution: 'temurin' | |
| cache: gradle | |
| - name: Grant execute permission for gradlew | |
| run: chmod +x gradlew | |
| - name: Build with Gradle | |
| run: ./gradlew assembleDebug --no-daemon | |
| - name: Run unit tests | |
| run: ./gradlew testDebugUnitTest --no-daemon | |
| - name: Upload APK | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: debug-apk | |
| path: client/app/build/outputs/apk/debug/*.apk | |
| retention-days: 7 | |
| lint: | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: client | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '17' | |
| distribution: 'temurin' | |
| cache: gradle | |
| - name: Grant execute permission for gradlew | |
| run: chmod +x gradlew | |
| - name: Run lint | |
| run: ./gradlew lintDebug --no-daemon | |
| - name: Upload lint report | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: lint-report | |
| path: client/app/build/reports/lint-results-debug.html | |
| retention-days: 7 | |
| release: | |
| runs-on: ubuntu-latest | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| needs: [build, lint] | |
| defaults: | |
| run: | |
| working-directory: client | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '17' | |
| distribution: 'temurin' | |
| cache: gradle | |
| - name: Grant execute permission for gradlew | |
| run: chmod +x gradlew | |
| - name: Build Release APK | |
| run: ./gradlew assembleRelease --no-daemon | |
| env: | |
| KEYSTORE_BASE64: ${{ secrets.KEYSTORE_BASE64 }} | |
| KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }} | |
| KEY_ALIAS: ${{ secrets.KEY_ALIAS }} | |
| KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }} | |
| - name: Get version from tag | |
| id: version | |
| run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| files: client/app/build/outputs/apk/release/*.apk | |
| tag_name: ${{ steps.version.outputs.VERSION }} | |
| generate_release_notes: true | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |