Dev Builds #60
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: Dev Builds | |
| on: | |
| workflow_dispatch: | |
| jobs: | |
| prepare: | |
| name: Prepare dev metadata | |
| runs-on: ubuntu-latest | |
| outputs: | |
| version: ${{ steps.changelog.outputs.version }} | |
| base_version: ${{ steps.changelog.outputs.base_version }} | |
| dev_suffix: ${{ steps.changelog.outputs.dev_suffix }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "lts/*" | |
| cache: npm | |
| - name: Extract dev release notes | |
| id: changelog | |
| run: | | |
| node - <<'NODE' | |
| const fs = require('fs'); | |
| const p = 'api/DEV-CHANGELOG.md'; | |
| if (!fs.existsSync(p)) throw new Error(`Changelog not found at ${p}`); | |
| const lines = fs.readFileSync(p, 'utf8').split(/\r?\n/); | |
| const section = []; | |
| for (let i = 0; i < lines.length; i += 1) { | |
| const line = lines[i]; | |
| if (i > 0 && /^#\s*v/i.test(line)) break; | |
| section.push(line); | |
| } | |
| const content = section.join('\n').replace(/\s+$/, ''); | |
| if (!content.trim()) throw new Error('No dev release notes content extracted from changelog.'); | |
| const header = section.find((l) => /^#\s*v/i.test(l)); | |
| if (!header) throw new Error('Failed to locate version header in dev changelog.'); | |
| const m = header.match(/^#\s*(v([0-9]+\.[0-9]+\.[0-9]+)-dev\.([0-9]{2,}))/i); | |
| if (!m) throw new Error(`Unable to parse dev version from changelog header: "${header}"`); | |
| const version = m[1]; | |
| const baseVersion = m[2]; | |
| const devSuffix = `dev.${m[3]}`; | |
| fs.writeFileSync('dev_release_notes.md', `${content}\n`, 'utf8'); | |
| fs.appendFileSync(process.env.GITHUB_OUTPUT, `version=${version}\n`); | |
| fs.appendFileSync(process.env.GITHUB_OUTPUT, `base_version=${baseVersion}\n`); | |
| fs.appendFileSync(process.env.GITHUB_OUTPUT, `dev_suffix=${devSuffix}\n`); | |
| NODE | |
| - name: Upload dev release notes | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: dev-release-notes | |
| retention-days: 1 | |
| if-no-files-found: error | |
| path: dev_release_notes.md | |
| build: | |
| name: Build signed APKs | |
| runs-on: ubuntu-latest | |
| needs: prepare | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Java | |
| id: setup-java | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: temurin | |
| java-version: '17' | |
| - name: Set Gradle Java Home | |
| run: echo "ORG_GRADLE_JAVA_HOME=${{ steps.setup-java.outputs.path }}" >> "$GITHUB_ENV" | |
| - name: Cache Gradle | |
| uses: burrunan/gradle-cache-action@v3 | |
| - name: Setup keystore | |
| run: | | |
| echo "${{ secrets.KEYSTORE }}" | base64 --decode > "app/keystore.jks" | |
| - name: Build dev | |
| env: | |
| GITHUB_ACTOR: ${{ github.actor }} | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }} | |
| KEYSTORE_ENTRY_ALIAS: ${{ secrets.KEYSTORE_ENTRY_ALIAS }} | |
| KEYSTORE_ENTRY_PASSWORD: ${{ secrets.KEYSTORE_ENTRY_PASSWORD }} | |
| run: | | |
| ./gradlew -Dorg.gradle.java.home="${{ steps.setup-java.outputs.path }}" --no-daemon \ | |
| -Pversion="${{ needs.prepare.outputs.base_version }}" \ | |
| -PdevVersionSuffix="${{ needs.prepare.outputs.dev_suffix }}" \ | |
| :app:assembleDev \ | |
| :revanced.v21-runtime-plugin:assembleRelease | |
| - name: Locate dev artifacts | |
| id: artifact | |
| env: | |
| VERSION: ${{ needs.prepare.outputs.version }} | |
| run: | | |
| APK_DIR="app/build/outputs/apk/dev" | |
| REVANCED_V21_PLUGIN="revanced.v21-runtime-plugin/build/outputs/apk/release/revanced.v21-plugin.apk" | |
| EXPECTED=( | |
| "${APK_DIR}/universal-revanced-manager-${VERSION}-universal.apk" | |
| "${APK_DIR}/universal-revanced-manager-${VERSION}-arm64-v8a.apk" | |
| "${APK_DIR}/universal-revanced-manager-${VERSION}-armeabi-v7a.apk" | |
| "${APK_DIR}/universal-revanced-manager-${VERSION}-x86.apk" | |
| "${APK_DIR}/universal-revanced-manager-${VERSION}-x86_64.apk" | |
| "${REVANCED_V21_PLUGIN}" | |
| ) | |
| for name in "${EXPECTED[@]}"; do | |
| if [ ! -f "$name" ]; then | |
| echo "Missing expected dev APK artifact: $name" | |
| ls -la "$APK_DIR" || true | |
| ls -la "$(dirname "$REVANCED_V21_PLUGIN")" || true | |
| exit 1 | |
| fi | |
| echo "Found $name" | |
| done | |
| echo "apk_dir=$APK_DIR" >> "$GITHUB_OUTPUT" | |
| - name: Upload APK artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: urv-dev | |
| retention-days: 14 | |
| if-no-files-found: error | |
| path: | | |
| ${{ steps.artifact.outputs.apk_dir }}/universal-revanced-manager-${{ needs.prepare.outputs.version }}-universal.apk | |
| ${{ steps.artifact.outputs.apk_dir }}/universal-revanced-manager-${{ needs.prepare.outputs.version }}-arm64-v8a.apk | |
| ${{ steps.artifact.outputs.apk_dir }}/universal-revanced-manager-${{ needs.prepare.outputs.version }}-armeabi-v7a.apk | |
| ${{ steps.artifact.outputs.apk_dir }}/universal-revanced-manager-${{ needs.prepare.outputs.version }}-x86.apk | |
| ${{ steps.artifact.outputs.apk_dir }}/universal-revanced-manager-${{ needs.prepare.outputs.version }}-x86_64.apk | |
| revanced.v21-runtime-plugin/build/outputs/apk/release/revanced.v21-plugin.apk | |
| app/build/outputs/apk/dev/output-metadata.json | |
| publish: | |
| name: Publish prerelease | |
| runs-on: ubuntu-latest | |
| needs: [prepare, build] | |
| permissions: | |
| contents: write | |
| env: | |
| GH_REPO: ${{ github.repository }} | |
| steps: | |
| - name: Download dev APK artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: urv-dev | |
| path: release-artifacts | |
| - name: Download dev release notes | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: dev-release-notes | |
| path: . | |
| - name: Prepare prerelease tag | |
| id: release | |
| env: | |
| VERSION: ${{ needs.prepare.outputs.version }} | |
| run: | | |
| if [ -z "${VERSION}" ]; then | |
| echo "Version extracted from dev changelog is empty." | |
| exit 1 | |
| fi | |
| echo "NEW_TAG=${VERSION}" >> "$GITHUB_OUTPUT" | |
| - name: Publish prerelease | |
| if: steps.release.outputs.NEW_TAG != '' | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| TAG: ${{ steps.release.outputs.NEW_TAG }} | |
| run: | | |
| if ! gh release view "$TAG" >/dev/null 2>&1; then | |
| gh release create "$TAG" --title "Universal ReVanced Manager ${TAG}" --notes-file dev_release_notes.md --prerelease | |
| else | |
| gh release edit "$TAG" --title "Universal ReVanced Manager ${TAG}" --notes-file dev_release_notes.md --prerelease | |
| fi | |
| gh release upload "$TAG" release-artifacts/*.apk --clobber |