Build pull request 2242 #5
Workflow file for this run
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: Build pull request | |
on: | |
workflow_dispatch: | |
inputs: | |
# Enable or disable cache | |
flutter-cache: | |
description: Cache | |
type: boolean | |
default: true | |
# Select app flavour | |
app-flavour: | |
description: App flavour | |
default: 'release' | |
type: choice | |
options: | |
- release | |
- debug | |
- profile | |
# Select pull request | |
pr-number: | |
description: PR number (Without hashtag) | |
required: true | |
run-name: "Build pull request ${{ inputs.pr-number }}" | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
pull-requests: write | |
steps: | |
- name: Setup pull request | |
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 "COMMIT_HASH=$(git rev-parse --short HEAD)" >> $GITHUB_ENV | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
fetch-depth: 0 | |
- name: Cache Gradle | |
uses: burrunan/gradle-cache-action@v2 | |
- name: Setup Java | |
run: echo "JAVA_HOME=$JAVA_HOME_17_X64" >> $GITHUB_ENV | |
- name: Set up Flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
channel: "stable" | |
flutter-version: 3.24.x | |
cache: ${{ inputs.flutter-cache }} | |
- name: Get dependencies | |
run: flutter pub get | |
- name: Generate translations | |
run: dart run slang | |
- name: Generate code files | |
run: dart run build_runner build --delete-conflicting-outputs | |
- name: Build | |
continue-on-error: true | |
id: flutter-build | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
flutter build apk --"${{ inputs.app-flavour }}"; | |
- name: Prepare comment | |
run: | | |
if [[ "${{ steps.flutter-build.outcome }}" == "success" ]]; then | |
echo "MESSAGE=β Succeeded build on ${{ env.COMMIT_HASH }}." >> $GITHUB_ENV | |
else | |
echo "MESSAGE=π« Failed build on ${{ env.COMMIT_HASH }}." >> $GITHUB_ENV | |
fi | |
- name: "Comment on 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: | | |
## βοΈ Build status | |
${{ env.MESSAGE }} | |
Details: [${{ github.run_id }}](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})! | |
### βοΈ Workflow run configuration | |
- Flutter cache: ${{ inputs.flutter-cache }} | |
- App flavor: ${{ inputs.app-flavour }} | |
- name: Upload | |
uses: actions/upload-artifact@v4 | |
with: | |
if-no-files-found: error | |
name: revanced-manager-(${{ env.COMMIT_HASH }}-${{ inputs.pr-number }}-${{ inputs.app-flavour }}) | |
path: | | |
build/app/outputs/flutter-apk/app-${{ inputs.app-flavour }}.apk | |
build/app/outputs/flutter-apk/app-${{ inputs.app-flavour }}.apk.sha1 |