build: workflows for PRs & all commits

This commit is contained in:
Ushie 2022-11-26 21:16:29 +03:00
parent 149af96d51
commit 47529ae3f5
No known key found for this signature in database
GPG Key ID: 0EF73F1CA38B2D5F
2 changed files with 66 additions and 14 deletions

55
.github/workflows/commit-build.yml vendored Normal file
View File

@ -0,0 +1,55 @@
name: "Android CI Actions"
on:
push:
branches:
- "**"
tags-ignore:
- "v*" # Ignore tags that start with "v" (e.g. v1.0.0) because they are handled by release-build.yml
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set env
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Set up JDK 12
uses: actions/setup-java@v3
with:
java-version: '12'
distribution: 'zulu'
- uses: subosito/flutter-action@v2
with:
channel: 'stable'
- name: Set environment variables
run: echo $SECRETS | base64 -d > lib/utils/environment.dart
env:
SECRETS: ${{ secrets.SECRETS }}
- name: Set up Flutter
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.signedReleaseFile}} revanced-manager-${{ env.RELEASE_VERSION }}.apk
- name: Upload APK
uses: actions/upload-artifact@v2
with:
name: revanced-manager-${{ env.RELEASE_VERSION }}
path: revanced-manager-${{ env.RELEASE_VERSION }}.apk

View File

@ -1,17 +1,17 @@
name: "Debug Build" name: "Android CI PR Build"
on: on:
push: pull_request:
branches: branches:
- "flutter-disabled" - "**"
tags-ignore:
- "*"
jobs: jobs:
release: release:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Set env
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Set up JDK 12 - name: Set up JDK 12
uses: actions/setup-java@v3 uses: actions/setup-java@v3
with: with:
@ -31,14 +31,11 @@ jobs:
- name: Build with Flutter - name: Build with Flutter
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: flutter build apk --debug run: flutter build apk
- name: Add version to APK - name: Add version to APK
run: mv build/app/outputs/flutter-apk/app-debug.apk revanced-manager-latest.apk run: mv build/app/outputs/flutter-apk/app-release.apk revanced-manager-${{ env.RELEASE_VERSION }}.apk
- name: Publish debug APK - name: Upload APK
uses: "marvinpinto/action-automatic-releases@latest" uses: actions/upload-artifact@v2
with: with:
repo_token: "${{ secrets.GITHUB_TOKEN }}" name: revanced-manager-${{ env.RELEASE_VERSION }}
automatic_release_tag: "latest" path: revanced-manager-${{ env.RELEASE_VERSION }}.apk
prerelease: true
title: "Development Build"
files: revanced-manager-latest.apk