-
-
Notifications
You must be signed in to change notification settings - Fork 274
158 lines (142 loc) · 4.35 KB
/
ci.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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
name: CI
on:
pull_request:
paths-ignore:
- '.idea/**'
- '.github/ISSUE_TEMPLATE/**'
- '.gitattributes'
- '.gitignore'
- '*.md'
- 'LICENSE'
- 'custom-game-area/**'
- 'wiki/**'
push:
branches:
- master
paths-ignore:
- '.idea/**'
- '.github/**'
- '.gitattributes'
- '.gitignore'
- '*.md'
- 'LICENSE'
- 'renovate.json'
- 'custom-game-area/**'
- 'FUNDING.yml'
- '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'
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: Upload APK
uses: actions/upload-artifact@v4
with:
name: apk
path: app/build/outputs/apk/ci/app-ci.apk
- name: Upload De-obfuscation mapping file
uses: actions/upload-artifact@v4
with:
name: mapping-ci
path: app/build/outputs/mapping/ci/mapping.txt
play_store:
runs-on: macos-14
if: github.ref == 'refs/heads/master'
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: Decrypt keystore (GPG)
env:
GPG_KEYSTORE: ${{ secrets.GPG_KEYSTORE }}
working-directory: ./app
run: gpg --quiet --batch --yes --decrypt --passphrase="$GPG_KEYSTORE" --output fgautomata.keystore fgautomata.keystore.gpg
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.2'
bundler-cache: true
- name: Deploy to Play Store
uses: maierj/[email protected]
with:
lane: 'deploy'
env:
SUPPLY_JSON_KEY_DATA: ${{ secrets.SERVICE_ACCOUNT_NEW_APP }}
KEYSTORE_PASS: ${{ secrets.KEYSTORE_PASS }}
- name: Upload Bundle
uses: actions/upload-artifact@v4
with:
name: bundle
path: app/build/outputs/bundle/release/app-release.aab
if: ${{ !cancelled() }}
- name: Upload De-obfuscation mapping file
uses: actions/upload-artifact@v4
with:
name: mapping-release
path: app/build/outputs/mapping/release/mapping.txt
if: ${{ !cancelled() }}
# Release master branch
github_release:
needs: play_store
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.2'
bundler-cache: true
- name: Download Universal APK
uses: maierj/[email protected]
with:
lane: 'download_apk'
options: '{ "version_code": "$VERSION_CODE" }'
env:
SUPPLY_JSON_KEY_DATA: ${{ secrets.SERVICE_ACCOUNT_NEW_APP }}
- name: zip APK
run: zip FGA-apk-${VERSION_CODE}.zip *.apk
- name: Create tag
uses: mathieudutour/[email protected]
with:
custom_tag: ${{ env.VERSION_CODE }}
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Create release
uses: ncipollo/[email protected]
with:
generateReleaseNotes: true
artifacts: 'FGA-apk-${{ env.VERSION_CODE }}.zip'
tag: 'v${{ env.VERSION_CODE }}'
name: 'FGA ${{ env.VERSION_CODE }}'
prerelease: true