name: Android Release on: push: branches: - "**" tags-ignore: - "v*" pull_request: branches: - "**" workflow_dispatch: jobs: version: name: Create version number runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 with: fetch-depth: 0 - name: Fetch all history for all tags and branches run: | git config remote.origin.url https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }} git fetch --prune --depth=10000 - name: Install GitVersion uses: gittools/actions/gitversion/setup@v0.9.7 with: versionSpec: "5.x" - name: Use GitVersion id: gitversion uses: gittools/actions/gitversion/execute@v0.9.7 - name: Create version.txt with nuGetVersion run: echo ${{ steps.gitversion.outputs.nuGetVersion }} > version.txt - name: Upload version.txt uses: actions/upload-artifact@v2 with: name: gitversion path: version.txt build: name: Create Android Build needs: version runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - name: Get version.txt uses: actions/download-artifact@v2 with: name: gitversion - name: Create new file without newline char from version.txt run: tr -d '\n' < version.txt > version1.txt - name: Read version id: version uses: juliangruber/read-file-action@v1 with: path: version1.txt - name: Update version in YAML run: sed -i 's/99.99.99+99/${{ steps.version.outputs.content }}+${{ github.run_number }}/g' pubspec.yaml - name: Download Android keystore id: android_keystore uses: timheuer/base64-to-file@v1.0.3 with: fileName: upload-keystore.jks encodedString: ${{ secrets.SIGNING_KEYSTORE }} - name: Create key.properties run: | echo "storeFile=${{ steps.android_keystore.outputs.filePath }}" > android/key.properties echo "storePassword=${{ secrets.SIGNING_KEYSTORE_PASSWORD }}" >> android/key.properties echo "keyPassword=${{ secrets.SIGNING_KEY_PASSWORD }}" >> android/key.properties echo "keyAlias=${{ secrets.SIGNING_KEY_ALIAS }}" >> android/key.properties - uses: actions/setup-java@v3 with: distribution: 'zulu' java-version: "12.x" cache: gradle - uses: subosito/flutter-action@v2 with: channel: 'stable' cache: true - name: Get dependencies run: flutter pub get - name: Generate files with Builder run: flutter packages pub run build_runner build --delete-conflicting-outputs - name: Build with Flutter env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SIGNING_KEY_ALIAS: ${{ secrets.SIGNING_KEY_ALIAS }} SIGNING_KEY_PASSWORD: ${{ secrets.SIGNING_KEY_PASSWORD }} SIGNING_STORE_PASSWORD: ${{ secrets.SIGNING_KEYSTORE_PASSWORD }} run: flutter build apk - name: Sign APK id: sign_apk uses: ilharp/sign-android-release@v1 with: releaseDir: build/app/outputs/apk/release signingKey: ${{ secrets.SIGNING_KEYSTORE }} keyStorePassword: ${{ secrets.SIGNING_KEYSTORE_PASSWORD }} keyAlias: ${{ secrets.SIGNING_KEY_ALIAS }} keyPassword: ${{ secrets.SIGNING_KEY_PASSWORD }} - name: Add version to APK run: mv ${{ steps.sign_apk.outputs.signedFile }} revanced-manager-${{ env.RELEASE_VERSION }}.apk - name: Upload APK uses: actions/upload-artifact@v3 with: name: revanced-manager-${{ env.RELEASE_VERSION }} path: revanced-manager-${{ env.RELEASE_VERSION }}.apk # deploy: # name: Deploy Android Build # needs: build # runs-on: ubuntu-latest # steps: # - uses: actions/checkout@v1 # - name: Get Android Build from artifacts # uses: actions/download-artifact@v2 # with: # name: android-release env: ACTIONS_ALLOW_UNSECURE_COMMANDS: true