mirror of
https://github.com/revanced/revanced-manager.git
synced 2025-04-30 05:54:26 +02:00
ci: Improve build pull request v3
This commit is contained in:
parent
d3036105bb
commit
89ad88c0ef
101
.github/workflows/build_pull_request.yml
vendored
101
.github/workflows/build_pull_request.yml
vendored
@ -3,15 +3,13 @@ name: Build pull request
|
|||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
inputs:
|
inputs:
|
||||||
# Enable or disable cache
|
# Select pull request
|
||||||
flutter-cache:
|
pr-number:
|
||||||
description: Cache
|
description: PR number (Without hashtag)
|
||||||
type: boolean
|
required: true
|
||||||
default: true
|
# Select app flavor
|
||||||
|
app-flavor:
|
||||||
# Select app flavour
|
description: App flavor
|
||||||
app-flavour:
|
|
||||||
description: App flavour
|
|
||||||
default: 'release'
|
default: 'release'
|
||||||
type: choice
|
type: choice
|
||||||
options:
|
options:
|
||||||
@ -19,10 +17,25 @@ on:
|
|||||||
- debug
|
- debug
|
||||||
- profile
|
- profile
|
||||||
|
|
||||||
# Select pull request
|
# Flutter Configurations,
|
||||||
pr-number:
|
# it's recommended to be set when you have problem regarding with flutter itself
|
||||||
description: PR number (Without hashtag)
|
# For most part you do not need to change this.
|
||||||
required: true
|
|
||||||
|
# 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 }}"
|
run-name: "Build pull request ${{ inputs.pr-number }}"
|
||||||
|
|
||||||
@ -34,35 +47,23 @@ jobs:
|
|||||||
contents: read
|
contents: read
|
||||||
pull-requests: write
|
pull-requests: write
|
||||||
steps:
|
steps:
|
||||||
- name: Setup pull request
|
- name: Checkout PR
|
||||||
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
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
persist-credentials: false
|
ref: refs/pull/${{ inputs.pr-number }}/merge
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Cache Gradle
|
|
||||||
uses: burrunan/gradle-cache-action@v2
|
|
||||||
|
|
||||||
- name: Setup Java
|
- name: Setup Java
|
||||||
run: echo "JAVA_HOME=$JAVA_HOME_17_X64" >> $GITHUB_ENV
|
uses: actions/setup-java@v4
|
||||||
|
with:
|
||||||
|
distribution: 'temurin'
|
||||||
|
java-version: '17'
|
||||||
|
|
||||||
- name: Set up Flutter
|
- name: Set up Flutter
|
||||||
uses: subosito/flutter-action@v2
|
uses: subosito/flutter-action@v2
|
||||||
with:
|
with:
|
||||||
channel: "stable"
|
channel: ${{ inputs.flutter-channel }}
|
||||||
flutter-version: 3.24.x
|
flutter-version: ${{ inputs.flutter-version }}
|
||||||
cache: ${{ inputs.flutter-cache }}
|
|
||||||
|
|
||||||
- name: Get dependencies
|
- name: Get dependencies
|
||||||
run: flutter pub get
|
run: flutter pub get
|
||||||
@ -76,42 +77,44 @@ jobs:
|
|||||||
- name: Build
|
- name: Build
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
id: flutter-build
|
id: flutter-build
|
||||||
env:
|
run: flutter build apk --${{ inputs.app-flavor }}
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
run: |
|
|
||||||
flutter build apk --"${{ inputs.app-flavour }}";
|
|
||||||
|
|
||||||
- name: Prepare comment
|
- name: Prepare comment
|
||||||
run: |
|
run: |
|
||||||
|
COMMIT_HASH=$(git rev-parse --short HEAD)
|
||||||
if [[ "${{ steps.flutter-build.outcome }}" == "success" ]]; then
|
if [[ "${{ steps.flutter-build.outcome }}" == "success" ]]; then
|
||||||
echo "MESSAGE=✅ Succeeded build on ${{ env.COMMIT_HASH }}." >> $GITHUB_ENV
|
MESSAGE="✅ Succeeded build on $COMMIT_HASH."
|
||||||
else
|
else
|
||||||
echo "MESSAGE=🚫 Failed build on ${{ env.COMMIT_HASH }}." >> $GITHUB_ENV
|
MESSAGE="🚫 Failed build on $COMMIT_HASH."
|
||||||
fi
|
fi
|
||||||
|
echo "MESSAGE=$MESSAGE" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
- name: "Comment on pull request #${{ inputs.pr-number }}"
|
- name: "Comment on pull request #${{ inputs.pr-number }}"
|
||||||
uses: thollander/actions-comment-pull-request@v2
|
uses: thollander/actions-comment-pull-request@v3
|
||||||
with:
|
with:
|
||||||
GITHUB_TOKEN: ${{ github.token }}
|
github-token: ${{ github.token }}
|
||||||
pr_number: ${{ inputs.pr-number }}
|
pr-number: ${{ inputs.pr-number }}
|
||||||
mode: recreate
|
mode: recreate
|
||||||
|
comment-tag: execution
|
||||||
message: |
|
message: |
|
||||||
## ⚒️ Build status
|
## ⚒️ Build status
|
||||||
|
|
||||||
${{ env.MESSAGE }}
|
🧪 Workflow triggered by: ${{ github.actor }}
|
||||||
|
|
||||||
Details: [${{ github.run_id }}](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})!
|
${{ 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
|
### ⚙️ Workflow run configuration
|
||||||
|
|
||||||
- Flutter cache: ${{ inputs.flutter-cache }}
|
- App flavor: ${{ inputs.app-flavor }}
|
||||||
- App flavor: ${{ inputs.app-flavour }}
|
- Flutter version: ${{ inputs.flutter-version }} (${{ inputs.flutter-channel }})
|
||||||
|
|
||||||
- name: Upload
|
- name: Upload Artifact
|
||||||
|
if: steps.flutter-build.outcome == 'success'
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
if-no-files-found: error
|
name: revanced-manager-(${{ steps.prepare-comment.outputs.COMMIT_HASH }}-${{ inputs.pr-number }}-${{ inputs.app-flavor }}-${{ inputs.flutter-version }})
|
||||||
name: revanced-manager-(${{ env.COMMIT_HASH }}-${{ inputs.pr-number }}-${{ inputs.app-flavour }})
|
|
||||||
path: |
|
path: |
|
||||||
build/app/outputs/flutter-apk/app-${{ inputs.app-flavour }}.apk
|
build/app/outputs/flutter-apk/app-${{ inputs.app-flavour }}.apk
|
||||||
build/app/outputs/flutter-apk/app-${{ inputs.app-flavour }}.apk.sha1
|
build/app/outputs/flutter-apk/app-${{ inputs.app-flavour }}.apk.sha1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user