PR Build #16
This file contains 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: PR Build | |
on: | |
workflow_dispatch: | |
inputs: | |
flutter-branch: | |
required: true | |
type: choice | |
description: Flutter branch | |
default: 'stable' | |
options: | |
- stable | |
- beta | |
- dev | |
- master | |
app-flavour: | |
required: true | |
type: choice | |
description: App flavour | |
default: 'release' | |
options: | |
- release | |
- debug | |
- profile | |
pr-number: | |
required: true | |
description: PR number (No hashtag) | |
permissions: | |
contents: read | |
pull-requests: write | |
jobs: | |
build: | |
name: Build the application | |
runs-on: ubuntu-latest | |
continue-on-error: true | |
steps: | |
- name: Checkout the PR | |
env: | |
GH_TOKEN: ${{ github.token }} | |
run: | | |
gh repo clone ReVanced/revanced-manager | |
cd revanced-manager | |
gh repo set-default ReVanced/revanced-manager | |
gh pr checkout ${{ inputs.pr-number }} | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
- name: Setup JDK | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '11' | |
distribution: 'zulu' | |
cache: gradle | |
- name: Setup Flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
channel: ${{ inputs.flutter-branch }} | |
cache: true | |
- name: Install Flutter 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 }} | |
run: | | |
flutter build apk --${{ inputs.app-flavour }}; | |
echo "COMMIT_HASH=$(git rev-parse --short HEAD)" >> $GITHUB_ENV | |
- name: Upload build | |
uses: actions/upload-artifact@v3 | |
with: | |
name: revanced-manager-(${{ env.COMMIT_HASH }}-${{ inputs.pr-number }}-${{ inputs.app-flavour }})-${{ inputs.flutter-branch }} | |
path: | | |
build/app/outputs/flutter-apk/app-${{ inputs.app-flavour }}.apk | |
build/app/outputs/flutter-apk/app-${{ inputs.app-flavour }}.apk.sha1 | |
notify-pull-request: | |
name: Notify Pull Request | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Setup | |
run: | | |
echo "DATETIME=$(date +'%Y-%m-%d %H:%M:%S')" >> $GITHUB_ENV | |
if [[ "${{ needs.build.result }}" == "success" ]]; then | |
echo "MESSAGE=β Build succeeded!" >> $GITHUB_ENV | |
else | |
echo "MESSAGE=π« Build failed!" >> $GITHUB_ENV | |
fi | |
- name: "Comment to Pull Request #${{ inputs.pr-number }}" | |
uses: thollander/actions-comment-pull-request@v2 | |
with: | |
GITHUB_TOKEN: ${{ github.token }} | |
pr_number: ${{ inputs.pr-number }} | |
mode: recreate | |
message: | | |
${{ env.MESSAGE }} @ ${{ env.DATETIME }} | |
You can check the details [here](${{ github.event.workflow_run.html_url }}). | |
- App flavour: ${{ inputs.app-flavour }} | |
- Flutter branch: ${{ inputs.flutter-branch }} |