-
Notifications
You must be signed in to change notification settings - Fork 170
129 lines (105 loc) · 4.47 KB
/
alpha.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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
name: Alpha Build
on:
push:
branches:
- develop
jobs:
build-alpha:
name: Build Alpha Apk
runs-on: macos-latest
if: github.repository == 'aaa1115910/bv'
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: develop
fetch-depth: 0
submodules: 'true'
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
- name: Setup Gradle to generate and submit dependency graphs
uses: gradle/actions/setup-gradle@v3
with:
dependency-graph: generate-and-submit
- name: Write google-services.json
env:
DATA: ${{ secrets.GOOGLE_SERVICES_JSON }}
run: echo $DATA > app/google-services.json
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Add signing properties
env:
SIGNING_PROPERTIES: ${{ secrets.SIGNING_PROPERTIES }}
run: |
echo ${{ secrets.SIGNING_PROPERTIES }} > encoded_signing_properties
base64 -Dd -i encoded_signing_properties > signing.properties
- name: Add jks file
run: |
echo ${{ secrets.SIGN_KEY }} > ./encoded_key
base64 -Dd -i encoded_key > key.jks
- name: Build apk
run: ./gradlew assembleDefaultAlpha assembleDefaultDebug
- name: Read alpha apk output metadata
id: apk-meta-alpha
uses: juliangruber/read-file-action@v1
with:
path: app/build/outputs/apk/default/alpha/output-metadata.json
- name: Read alpha debug apk output metadata
id: apk-meta-alpha-debug
uses: juliangruber/read-file-action@v1
with:
path: app/build/outputs/apk/default/debug/output-metadata.json
- name: Parse apk infos
id: apk-infos
run: |
echo "alpha_info_version_code=${{ fromJson(steps.apk-meta-alpha.outputs.content).elements[0].versionCode }}" >> $GITHUB_ENV
echo "alpha_info_version_name=${{ fromJson(steps.apk-meta-alpha.outputs.content).elements[0].versionName }}" >> $GITHUB_ENV
echo "alpha_debug_info_version_code=${{ fromJson(steps.apk-meta-alpha-debug.outputs.content).elements[0].versionCode }}" >> $GITHUB_ENV
echo "alpha_debug_info_version_name=${{ fromJson(steps.apk-meta-alpha-debug.outputs.content).elements[0].versionName }}" >> $GITHUB_ENV
- name: Determine tag name
id: tag_name
run: echo "tag_name=alpha-r${{ env.alpha_info_version_code }}" >> $GITHUB_ENV
- name: Get changelog
id: changelog
run: |
{
echo "changelog<<EOF"
echo "$(git log --pretty=format:"- %s (%h)" ${{ github.event.before }}..${{ github.sha }})"
echo "EOF"
} >> "$GITHUB_ENV"
# upload artifacts alpha debug
- name: Archive alpha debug build artifacts
uses: actions/upload-artifact@v4
with:
name: Alpha debug build artifact
path: app/build/outputs/apk/default/debug/BV_${{ env.alpha_debug_info_version_code }}_${{ env.alpha_debug_info_version_name }}_default_universal.apk
# upload artifacts alpha
- name: Archive default alpha build mappings
uses: actions/upload-artifact@v4
with:
name: Alpha build mappings
path: app/build/outputs/mapping/defaultAlpha
- name: Archive alpha build artifacts
uses: actions/upload-artifact@v4
with:
name: Alpha build artifact
path: app/build/outputs/apk/default/alpha/BV_${{ env.alpha_info_version_code }}_${{ env.alpha_info_version_name }}_default_universal.apk
# zip mapping because softprops/action-gh-release can't upload folder
- name: Zip mapping
run: zip -rj mapping.zip app/build/outputs/mapping/defaultAlpha
# upload to github release
- name: Publish Pre-Release
uses: softprops/action-gh-release@v2
with:
files: |
app/build/outputs/apk/default/debug/BV_${{ env.alpha_debug_info_version_code }}_${{ env.alpha_debug_info_version_name }}_default_universal.apk
app/build/outputs/apk/default/alpha/BV_${{ env.alpha_info_version_code }}_${{ env.alpha_info_version_name }}_default_universal.apk
mapping.zip
tag_name: ${{ env.tag_name }}
name: ${{ env.alpha_info_version_name }}
prerelease: true
body: ${{ env.changelog }}
target_commitish: ${{ github.sha }}