mirror of
https://github.com/revanced/revanced-manager
synced 2024-05-14 13:56:57 +02:00
ci(build): Improve pull request build (#1305)
Co-authored-by: oSumAtrIX <johan.melkonyan1@web.de>
This commit is contained in:
parent
06ff36c836
commit
c0516c3665
112
.github/workflows/pr-build.yml
vendored
112
.github/workflows/pr-build.yml
vendored
@ -1,45 +1,121 @@
|
|||||||
name: PR Build
|
name: PR Build
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
workflow_dispatch:
|
||||||
paths:
|
inputs:
|
||||||
- ".github/workflows/pr-build.yml"
|
# Flutter
|
||||||
- "android/**"
|
flutter-branch:
|
||||||
- "assets/**"
|
description: Flutter branch
|
||||||
- "lib/**"
|
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 }}"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
name: Build
|
name: Build the application
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
pull-requests: write
|
||||||
steps:
|
steps:
|
||||||
|
- 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
|
||||||
|
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
# Make sure the release step uses its own credentials:
|
|
||||||
# https://github.com/cycjimmy/semantic-release-action#private-packages
|
|
||||||
persist-credentials: false
|
persist-credentials: false
|
||||||
fetch-depth: 0
|
|
||||||
- name: Setup JDK
|
- name: Setup JDK
|
||||||
uses: actions/setup-java@v3
|
uses: actions/setup-java@v3
|
||||||
with:
|
with:
|
||||||
java-version: '17'
|
java-version: '17'
|
||||||
distribution: 'zulu'
|
distribution: 'zulu'
|
||||||
|
cache: gradle
|
||||||
|
|
||||||
- name: Setup Flutter
|
- name: Setup Flutter
|
||||||
uses: subosito/flutter-action@v2
|
uses: subosito/flutter-action@v2
|
||||||
with:
|
with:
|
||||||
channel: 'stable'
|
channel: ${{ inputs.flutter-branch }}
|
||||||
cache: true
|
cache: ${{ inputs.flutter-cache }}
|
||||||
|
|
||||||
- name: Install Flutter dependencies
|
- name: Install Flutter dependencies
|
||||||
run: flutter pub get
|
run: flutter pub get
|
||||||
|
|
||||||
- name: Generate files with Builder
|
- name: Generate files with Builder
|
||||||
run: dart run build_runner build --delete-conflicting-outputs
|
run: dart run build_runner build --delete-conflicting-outputs
|
||||||
|
|
||||||
- name: Build with Flutter
|
- name: Build with Flutter
|
||||||
env:
|
continue-on-error: true
|
||||||
|
id: flutter-build
|
||||||
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
run: flutter build apk --debug
|
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 }}
|
||||||
|
|
||||||
- name: Upload build
|
- name: Upload build
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: revanced-manager
|
if-no-files-found: error
|
||||||
path: build/app/outputs/flutter-apk/app-debug.apk
|
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
|
||||||
|
Loading…
Reference in New Issue
Block a user