Skip to content

Build pull request 2420 #8

Build pull request 2420

Build pull request 2420 #8

name: Build pull request
on:
workflow_dispatch:
inputs:
# Select pull request
pr-number:
description: PR number (Without hashtag)
required: true
# Select app flavor
app-flavor:
description: App flavor
default: 'release'
type: choice
options:
- release
- debug
- profile
# Flutter Configurations,
# it's recommended to be set when you have problem regarding with flutter itself
# For most part you do not need to change this.
# Flutter version to use, note that the version had to exist in whether channel
# to grab
# Try using exact version or particular version on a specific branch instead of "any"
flutter-channel:
description: Flutter channel
default: 'stable'
type: choice
options:
- stable
- beta
- dev
- any
flutter-version:
description: Flutter version
default: '3.29.x'
run-name: "Build pull request ${{ inputs.pr-number }}"
jobs:
build:
name: Build
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- name: Checkout PR
uses: actions/checkout@v4
with:
ref: refs/pull/${{ inputs.pr-number }}/merge
fetch-depth: 0
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
channel: ${{ inputs.flutter-channel }}
flutter-version: ${{ inputs.flutter-version }}
- 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
run: flutter build apk --${{ inputs.app-flavor }}
- name: Prepare comment
run: |
COMMIT_HASH=$(git rev-parse --short HEAD)
if [[ "${{ steps.flutter-build.outcome }}" == "success" ]]; then
MESSAGE="βœ… Succeeded build on $COMMIT_HASH."
else
MESSAGE="🚫 Failed build on $COMMIT_HASH."
fi
echo "MESSAGE=$MESSAGE" >> $GITHUB_OUTPUT
- name: "Comment on pull request #${{ inputs.pr-number }}"
uses: thollander/actions-comment-pull-request@v3
with:
github-token: ${{ github.token }}
pr-number: ${{ inputs.pr-number }}
mode: recreate
comment-tag: execution
message: |
## βš’οΈ Build status
πŸ§ͺ Workflow triggered by: ${{ github.actor }}
${{ steps.prepare-comment.outputs.MESSAGE }}
Details: [_execution **${{ github.run_id }}** / attempt **${{ github.run_attempt }}**_](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})!
### βš™οΈ Workflow run configuration
- App flavor: ${{ inputs.app-flavor }}
- Flutter version: ${{ inputs.flutter-version }} (${{ inputs.flutter-channel }})
- name: Upload Artifact
if: steps.flutter-build.outcome == 'success'
uses: actions/upload-artifact@v4
with:
name: revanced-manager-(${{ steps.prepare-comment.outputs.COMMIT_HASH }}-${{ inputs.pr-number }}-${{ inputs.app-flavor }}-${{ inputs.flutter-version }})
path: |
build/app/outputs/flutter-apk/app-${{ inputs.app-flavour }}.apk
build/app/outputs/flutter-apk/app-${{ inputs.app-flavour }}.apk.sha1