@@ -3,29 +3,42 @@ name: Build pull request
33on :
44 workflow_dispatch :
55 inputs :
6- # Enable or disable cache
7- flutter-cache :
8- description : Cache
9- type : boolean
10- default : true
11-
12- # Select app flavour
13- app-flavour :
14- description : App flavour
6+ # Select pull request
7+ pr-number :
8+ description : PR number (Without hashtag)
9+ required : true
10+ # Select app flavor
11+ app-flavor :
12+ description : App flavor
1513 default : ' release'
1614 type : choice
17- options :
15+ options :
1816 - release
1917 - debug
2018 - profile
21-
22- # Select pull request
23- pr-number :
24- description : PR number (Without hashtag)
25- required : true
19+
20+ # Flutter Configurations,
21+ # it's recommended to be set when you have problem regarding with flutter itself
22+ # For most part you do not need to change this.
23+
24+ # Flutter version to use, note that the version had to exist in whether channel
25+ # to grab
26+ # Try using exact version or particular version on a specific branch instead of "any"
27+ flutter-channel :
28+ description : Flutter channel
29+ default : ' stable'
30+ type : choice
31+ options :
32+ - stable
33+ - beta
34+ - dev
35+ - any
36+ flutter-version :
37+ description : Flutter version
38+ default : ' 3.29.x'
2639
2740run-name : " Build pull request ${{ inputs.pr-number }}"
28-
41+
2942jobs :
3043 build :
3144 name : Build
@@ -34,84 +47,91 @@ jobs:
3447 contents : read
3548 pull-requests : write
3649 steps :
37- - name : Setup pull request
38- env :
39- GH_TOKEN : ${{ github.token }}
40- run : |
41- gh repo clone "${{ github.repository }}"
42- cd revanced-manager
43- gh repo set-default "${{ github.repository }}"
44- gh pr checkout "${{ inputs.pr-number }}"
45-
46- echo "COMMIT_HASH=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
47-
48- - name : Checkout
50+ - name : Checkout PR
4951 uses : actions/checkout@v4
5052 with :
51- persist-credentials : false
53+ ref : refs/pull/${{ inputs.pr-number }}/merge
5254 fetch-depth : 0
5355
54- - name : Cache Gradle
55- uses : burrunan/gradle-cache-action@v2
56-
5756 - name : Setup Java
58- run : echo "JAVA_HOME=$JAVA_HOME_17_X64" >> $GITHUB_ENV
57+ uses : actions/setup-java@v4
58+ with :
59+ distribution : ' temurin'
60+ java-version : ' 17'
5961
6062 - name : Set up Flutter
6163 uses : subosito/flutter-action@v2
6264 with :
63- channel : " stable"
64- flutter-version : 3.24.x
65- cache : ${{ inputs.flutter-cache }}
65+ channel : ${{ inputs.flutter-channel }}
66+ flutter-version : ${{ inputs.flutter-version }}
6667
6768 - name : Get dependencies
69+ continue-on-error : true
6870 run : flutter pub get
6971
7072 - name : Generate translations
73+ continue-on-error : true
7174 run : dart run slang
7275
7376 - name : Generate code files
77+ continue-on-error : true
7478 run : dart run build_runner build --delete-conflicting-outputs
7579
7680 - name : Build
7781 continue-on-error : true
7882 id : flutter-build
79- env :
83+ run : flutter build apk --${{ inputs.app-flavor }}
84+ env :
8085 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
81- run : |
82- flutter build apk --"${{ inputs.app-flavour }}";
8386
8487 - name : Prepare comment
88+ id : prepare-comment # This should work now?
8589 run : |
90+ echo "COMMIT_HASH=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
8691 if [[ "${{ steps.flutter-build.outcome }}" == "success" ]]; then
87- echo " MESSAGE=✅ Succeeded build on ${{ env. COMMIT_HASH }}." >> $GITHUB_ENV
92+ MESSAGE=" ✅ Succeeded build on $COMMIT_HASH."
8893 else
89- echo " MESSAGE=🚫 Failed build on ${{ env. COMMIT_HASH }}." >> $GITHUB_ENV
94+ MESSAGE=" 🚫 Failed build on $COMMIT_HASH."
9095 fi
9196
9297 - name : " Comment on pull request #${{ inputs.pr-number }}"
93- uses : thollander/actions-comment-pull-request@v2
98+ uses : thollander/actions-comment-pull-request@v3
9499 with :
95- GITHUB_TOKEN : ${{ github.token }}
96- pr_number : ${{ inputs.pr-number }}
100+ github-token : ${{ github.token }}
101+ pr-number : ${{ inputs.pr-number }}
97102 mode : recreate
103+ comment-tag : execution
98104 message : |
99105 ## ⚒️ Build status
100-
101- ${{ env.MESSAGE }}
102-
103- Details: [${{ github.run_id }}](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})!
104106
105- ### ⚙️ Workflow run configuration
107+ 🧪 Workflow triggered by: ${{ github.actor }}
108+
109+ ${{ steps.prepare-comment.outputs.MESSAGE }}
110+
111+ Details: [_Job execution **${{ github.run_id }}** / attempt **${{ github.run_attempt }}**_](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})!
112+
113+ ### ⚙️ Workflow Steps
114+
115+ | Step | Status |
116+ | :------------------------ | :------------------------------------------------------- |
117+ | **Get dependencies** | ${{ steps.get-dependencies.outcome || job.status }} |
118+ | **Generate translations** | ${{ steps.generate-translations.outcome || job.status }} |
119+ | **Generate code files** | ${{ steps.generate-code-files.outcome || job.status }} |
120+ | **Build** | ${{ steps.flutter-build.outcome }} |
121+
122+ ### ⚙️ Workflow Configuration
106123
107- - Flutter cache: ${{ inputs.flutter-cache }}
108- - App flavor: ${{ inputs.app-flavour }}
124+ | Parameter | Value |
125+ | :--------------- | :--------------------------------------- |
126+ | App flavor | ${{ inputs.app-flavor }} |
127+ | Flutter version | ${{ inputs.flutter-version }} |
128+ | Flutter channel | ${{ inputs.flutter-channel }} |
109129
110- - name : Upload
130+ - name : Upload Artifact
131+ if : steps.flutter-build.outcome == 'success'
111132 uses : actions/upload-artifact@v4
112133 with :
113- if-no-files-found : error
114- name : revanced-manager-(${{ env.COMMIT_HASH }}-${{ inputs.pr-number }}-${{ inputs.app-flavour }})
134+ name : revanced-manager-(${{ env.COMMIT_HASH }}-${{ inputs.pr-number }}-${{ inputs.app-flavor }}-${{ inputs.flutter-version }})
115135 path : |
116- build/app/outputs/flutter-apk/app-${{ inputs.app-flavour }}.apk
117- build/app/outputs/flutter-apk/app-${{ inputs.app-flavour }}.apk.sha1
136+ build/app/outputs/flutter-apk/app-${{ inputs.app-flavor }}.apk
137+ build/app/outputs/flutter-apk/app-${{ inputs.app-flavor }}.apk.sha1
0 commit comments