-
-
Notifications
You must be signed in to change notification settings - Fork 280
93 lines (78 loc) · 2.97 KB
/
pr-build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
name: PR Build
on:
pull_request:
paths-ignore:
- '.idea/**'
- '.github/ISSUE_TEMPLATE/**'
- '.gitattributes'
- '.gitignore'
- '*.md'
- 'LICENSE'
- 'custom-game-area/**'
- 'wiki/**'
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
JAVA_VERSION: 17
JAVA_DISTRO: 'temurin'
VERSION_CODE: '${{ github.run_number }}'
jobs:
build:
runs-on: macos-14
if: github.ref != 'refs/heads/master'
permissions:
pull-requests: write
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: ${{ env.JAVA_VERSION }}
distribution: ${{ env.JAVA_DISTRO }}
cache: 'gradle'
- name: Determine Version Name
shell: bash
run: |
VERSION_NAME=$VERSION_CODE
echo "FGA_VERSION_CODE=$VERSION_CODE" >>${GITHUB_ENV}
echo "FGA_VERSION_NAME=$VERSION_NAME" >>${GITHUB_ENV}
- name: Build Android Package
run: ./gradlew assembleCi --scan --parallel --no-daemon
- name: Rename Artifacts
run: |
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
build_name="${{ github.run_number }}"
else
build_name="${{ github.event.pull_request.number }}-build-${{ github.run_number }}"
fi
mv app/build/outputs/apk/ci/app-ci.apk app/build/outputs/apk/ci/fga-pr-$build_name.apk
mv app/build/outputs/mapping/ci/mapping.txt app/build/outputs/apk/ci/fga-mapping-$build_name.txt
echo "FGA_APK_PATH=app/build/outputs/apk/ci/fga-pr-$build_name.apk" >>${GITHUB_ENV}
echo "FGA_MAPPING_PATH=app/build/outputs/apk/ci/fga-mapping-$build_name.txt" >>${GITHUB_ENV}
echo "FGA_APK_ARTIFACT_NAME=FGA-apk-PR-$build_name" >>${GITHUB_ENV}
echo "FGA_MAPPING_ARTIFACT_NAME=FGA-mapping-PR-$build_name" >>${GITHUB_ENV}
- name: Upload APK
id: upload-apk
uses: actions/upload-artifact@v4
with:
name: ${{ env.FGA_APK_ARTIFACT_NAME }}
path: ${{ env.FGA_APK_PATH }}
- name: Upload De-obfuscation mapping file
uses: actions/upload-artifact@v4
with:
name: ${{ env.FGA_MAPPING_ARTIFACT_NAME }}
path: ${{ env.FGA_MAPPING_PATH }}
- name: Comment the APK
if: ${{ github.event_name != 'workflow_dispatch' }}
uses: thollander/actions-comment-pull-request@v3
with:
comment-tag: apk
message: |
# [Build ${{ github.run_number }}](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})
Download the latest APK for testing [here](${{ steps.upload-apk.outputs.artifact-url }})
> [!NOTE]
> You need a GitHub account to download the APK.
>
> This URL is valid as long as the artifact has not expired yet.