Build PR 17 #24
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: | |
description: Flutter branch | |
type: choice | |
default: 'stable' | |
options: | |
- stable | |
- beta | |
- dev | |
- master | |
flutter-cache: | |
description: Flutter cache | |
type: boolean | |
default: true | |
app-flavour: | |
description: App flavour | |
default: 'release' | |
type: choice | |
options: | |
- release | |
- debug | |
- profile | |
pr-number: | |
description: PR number (No hashtag) | |
required: true | |
run-name: "Build PR ${{ inputs.pr-number }}" | |
jobs: | |
build: | |
name: Build the application | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
pull-requests: write | |
steps: | |
- name: Setup | |
env: | |
GH_TOKEN: ${{ github.token }} | |
run: | | |
echo "DATETIME=$( TZ='UTC+0' date --rfc-email )" >> $GITHUB_ENV | |
gh repo clone ${{ github.repository }} | |
cd revanced-manager | |
gh repo set-default ${{ github.repository }} | |
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: ${{ inputs.flutter-cache }} | |
- 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 | |
continue-on-error: true | |
id: flutter-build | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
flutter build pk --${{ inputs.app-flavour }}; | |
- name: Prepare to comment & upload artefacts | |
run: | | |
echo "COMMIT_HASH=$( git rev-parse --short HEAD )" >> $GITHUB_ENV | |
if [[ "${{ steps.flutter-build.outcome }}" == "success" ]]; then | |
echo "MESSAGE=β The CI has sucessfully built ReVanced Manager at ${{ env.COMMIT_HASH }}." >> $GITHUB_ENV | |
else | |
echo "MESSAGE=π« The CI has unable to build ReVanced Manager at ${{ env.COMMIT_HASH }}." >> $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 check the details on run ID [${{ github.run_id }}](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})! | |
### βοΈ Overview | |
- App flavour: ${{ inputs.app-flavour }} | |
- Flutter branch: ${{ inputs.flutter-branch }} | |
- Flutter cache: ${{ inputs.flutter-cache }} | |
- Start time: ${{ env.DATETIME }} | |
- 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 |