2023-08-03 22:58:50 +02:00
|
|
|
name: PR Build
|
|
|
|
|
|
|
|
on:
|
2023-11-20 08:50:44 +01:00
|
|
|
workflow_dispatch:
|
|
|
|
inputs:
|
|
|
|
# Flutter
|
|
|
|
flutter-branch:
|
|
|
|
description: Flutter branch
|
|
|
|
type: choice
|
|
|
|
default: 'stable'
|
|
|
|
options:
|
|
|
|
- stable
|
|
|
|
- beta
|
|
|
|
- dev
|
|
|
|
- master
|
|
|
|
flutter-cache:
|
|
|
|
description: Cache
|
|
|
|
type: boolean
|
|
|
|
default: true
|
|
|
|
# Application configuration
|
|
|
|
app-flavour:
|
|
|
|
description: App flavour
|
|
|
|
default: 'release'
|
|
|
|
type: choice
|
|
|
|
options:
|
|
|
|
- release
|
|
|
|
- debug
|
|
|
|
- profile
|
|
|
|
# Pull Request
|
|
|
|
pr-number:
|
|
|
|
description: PR number (No hashtag)
|
|
|
|
required: true
|
|
|
|
|
|
|
|
run-name: "Build PR ${{ inputs.pr-number }}"
|
|
|
|
|
2023-08-03 22:58:50 +02:00
|
|
|
jobs:
|
|
|
|
build:
|
2023-11-20 08:50:44 +01:00
|
|
|
name: Build the application
|
2023-08-03 22:58:50 +02:00
|
|
|
runs-on: ubuntu-latest
|
2023-11-20 08:50:44 +01:00
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
pull-requests: write
|
2023-08-03 22:58:50 +02:00
|
|
|
steps:
|
2023-11-20 08:50:44 +01:00
|
|
|
- name: Setup
|
|
|
|
env:
|
|
|
|
GH_TOKEN: ${{ github.token }}
|
|
|
|
run: |
|
|
|
|
gh repo clone ${{ github.repository }}
|
|
|
|
cd revanced-manager
|
|
|
|
gh repo set-default ${{ github.repository }}
|
|
|
|
gh pr checkout ${{ inputs.pr-number }}
|
|
|
|
|
|
|
|
echo "DATETIME=$( TZ='UTC+0' date --rfc-email )" >> $GITHUB_ENV
|
|
|
|
echo "COMMIT_HASH=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
|
|
|
|
|
2023-08-03 22:58:50 +02:00
|
|
|
- name: Checkout
|
2023-09-10 09:43:58 +02:00
|
|
|
uses: actions/checkout@v4
|
2023-08-03 22:58:50 +02:00
|
|
|
with:
|
|
|
|
persist-credentials: false
|
2023-11-20 08:50:44 +01:00
|
|
|
|
2023-08-03 22:58:50 +02:00
|
|
|
- name: Setup JDK
|
|
|
|
uses: actions/setup-java@v3
|
|
|
|
with:
|
2023-10-28 16:19:07 +02:00
|
|
|
java-version: '17'
|
2023-08-03 22:58:50 +02:00
|
|
|
distribution: 'zulu'
|
2023-11-20 08:50:44 +01:00
|
|
|
cache: gradle
|
|
|
|
|
2023-08-03 22:58:50 +02:00
|
|
|
- name: Setup Flutter
|
|
|
|
uses: subosito/flutter-action@v2
|
|
|
|
with:
|
2023-11-20 08:50:44 +01:00
|
|
|
channel: ${{ inputs.flutter-branch }}
|
|
|
|
cache: ${{ inputs.flutter-cache }}
|
|
|
|
|
2023-08-03 22:58:50 +02:00
|
|
|
- name: Install Flutter dependencies
|
|
|
|
run: flutter pub get
|
2023-11-20 08:50:44 +01:00
|
|
|
|
2023-08-03 22:58:50 +02:00
|
|
|
- name: Generate files with Builder
|
2023-11-20 08:50:44 +01:00
|
|
|
run: dart run build_runner build --delete-conflicting-outputs
|
|
|
|
|
2023-08-03 22:58:50 +02:00
|
|
|
- name: Build with Flutter
|
2023-11-20 08:50:44 +01:00
|
|
|
continue-on-error: true
|
|
|
|
id: flutter-build
|
|
|
|
env:
|
2023-08-03 22:58:50 +02:00
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
2023-11-20 08:50:44 +01:00
|
|
|
run: |
|
|
|
|
flutter build apk --${{ inputs.app-flavour }};
|
|
|
|
|
|
|
|
- name: Prepare to comment
|
|
|
|
run: |
|
|
|
|
if [[ "${{ steps.flutter-build.outcome }}" == "success" ]]; then
|
|
|
|
echo "MESSAGE=✅ ReVanced Manager ${{ env.COMMIT_HASH }} build succeeded." >> $GITHUB_ENV
|
|
|
|
else
|
|
|
|
echo "MESSAGE=🚫 ReVanced Manager ${{ env.COMMIT_HASH }} 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: |
|
|
|
|
## ⚒️ ReVanced PR Build workflow
|
|
|
|
|
|
|
|
${{ env.MESSAGE }}
|
|
|
|
|
|
|
|
You can see more details in run [${{ github.run_id }}](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})!
|
|
|
|
|
|
|
|
### ⚙️ Overview
|
|
|
|
- App flavor: ${{ inputs.app-flavour }}
|
|
|
|
- Branch: ${{ inputs.flutter-branch }}
|
|
|
|
- Start time: ${{ env.DATETIME }}
|
|
|
|
|
2023-08-03 22:58:50 +02:00
|
|
|
- name: Upload build
|
|
|
|
uses: actions/upload-artifact@v3
|
|
|
|
with:
|
2023-11-20 08:50:44 +01:00
|
|
|
if-no-files-found: error
|
|
|
|
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
|