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 Publish Release APK | |
| on: | |
| workflow_dispatch: | |
| push: | |
| jobs: | |
| build-and-publish: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Grant Gradle permission | |
| run: chmod +x ./gradlew | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@v3 | |
| with: | |
| java-version: 21 | |
| distribution: 'temurin' | |
| - name: Cache Gradle dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.gradle/caches | |
| ~/.gradle/wrapper | |
| key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }} | |
| - name: Build Release APK | |
| env: | |
| KEY_STORE_PASSWORD: ${{ secrets.KEY_STORE_PASSWORD }} | |
| KEY_ALIAS: ${{ secrets.KEY_ALIAS }} | |
| KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }} | |
| run: | | |
| echo "${{ secrets.RELEASE_SIGNING_KEY }}" | base64 --decode > keystore.jks | |
| ./gradlew assembleRelease | |
| - name: Extract version from build.gradle.kts | |
| id: version | |
| run: | | |
| VERSION=$(grep -oP 'versionName\s*=\s*\"\K[^"]+' app/build.gradle.kts | head -1) | |
| echo "Extracted version: $VERSION" | |
| echo "::set-output name=version::$VERSION" | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| tag_name: v${{ steps.version.outputs.version }} | |
| files: | | |
| app/build/outputs/apk/*/release/*.apk |