Merge branch 'feat/custom-webhook-api' into 'master' #6
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 & Release APK | |
| on: | |
| push: | |
| tags: | |
| - 'v*.*.*' | |
| branches: | |
| - '**' | |
| pull_request: | |
| branches: | |
| - '**' | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| name: Build Signed Release APK | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '17' | |
| distribution: 'temurin' | |
| cache: gradle | |
| - name: Setup Android SDK | |
| uses: android-actions/setup-android@v3 | |
| - name: Grant execute permission for gradlew | |
| run: chmod +x gradlew | |
| - name: Clean build | |
| run: ./gradlew clean | |
| - name: Decode Keystore | |
| run: | | |
| echo "${{ secrets.KEYSTORE_BASE64 }}" | base64 --decode > ${{ github.workspace }}/notif-forwarder-release.jks | |
| - name: Build Release APK | |
| run: | | |
| ./gradlew assembleRelease \ | |
| -Pandroid.injected.signing.store.file=${{ github.workspace }}/notif-forwarder-release.jks \ | |
| -Pandroid.injected.signing.store.password=${{ secrets.KEYSTORE_PASSWORD }} \ | |
| -Pandroid.injected.signing.key.alias=${{ secrets.KEY_ALIAS }} \ | |
| -Pandroid.injected.signing.key.password=${{ secrets.KEY_PASSWORD }} | |
| - name: Cleanup Keystore | |
| if: always() | |
| run: rm -f ${{ github.workspace }}/notif-forwarder-release.jks | |
| - name: Rename APK | |
| run: | | |
| if [[ "${{ github.ref }}" == refs/tags/* ]]; then | |
| VERSION="${{ github.ref_name }}" | |
| else | |
| BRANCH=$(echo "${{ github.ref_name }}" | sed 's/[^a-zA-Z0-9._-]/-/g') | |
| SHA=$(echo "${{ github.sha }}" | cut -c1-7) | |
| VERSION="${BRANCH}-${SHA}" | |
| fi | |
| APK_SRC="app/build/outputs/apk/release/app-release.apk" | |
| APK_DEST="NotificationForwarder-${VERSION}.apk" | |
| cp "$APK_SRC" "$APK_DEST" | |
| echo "APK_PATH=$APK_DEST" >> $GITHUB_ENV | |
| echo "VERSION=$VERSION" >> $GITHUB_ENV | |
| - name: Upload APK as Artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: NotificationForwarder-${{ env.VERSION }} | |
| path: ${{ env.APK_PATH }} | |
| retention-days: 30 | |
| - name: Create GitHub Release | |
| if: startsWith(github.ref, 'refs/tags/') | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| name: NotificationForwarder ${{ env.VERSION }} | |
| body: | | |
| ## NotificationForwarder ${{ env.VERSION }} | |
| ### Download | |
| Download the APK below and install it on your Android device. | |
| > **Minimum Android:** 8.0 (API 26) | |
| files: ${{ env.APK_PATH }} | |
| draft: false | |
| prerelease: false | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| permissions: | |
| contents: write |