-
-
Notifications
You must be signed in to change notification settings - Fork 273
158 lines (140 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/**'
push:
branches:
- master
tags:
- 'v*'
paths-ignore:
- '.idea/**'
- '.github/**'
- '.gitattributes'
- '.gitignore'
- '*.md'
- 'LICENSE'
- 'renovate.json'
- 'custom-game-area/**'
- 'FUNDING.yml'
workflow_dispatch:
inputs:
release-canary:
description: 'Release canary or not'
default: 'true'
required: true
release-playstore:
description: 'Release play store version or not'
default: 'true'
required: true
env:
JAVA_VERSION: 17
JAVA_DISTRO: 'temurin'
jobs:
build:
runs-on: ubuntu-latest
if: github.ref != 'refs/heads/master' || inputs.release-canary != 'false'
steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: ${{ env.JAVA_VERSION }}
distribution: ${{ env.JAVA_DISTRO }}
cache: 'gradle'
- name: Determine Version Name
shell: bash
run: |
VERSION_CODE=${{ github.run_number }}
VERSION_NAME=${{ github.run_number }}
if [[ ${{ github.ref }} == refs/tags/* ]]; then
VERSION_NAME = ${{ github.ref_name }}
fi
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@v3
with:
name: apk
path: app/build/outputs/apk/ci/app-ci.apk
- name: Upload De-obfuscation mapping file
uses: actions/upload-artifact@v3
with:
name: mapping-ci
path: app/build/outputs/mapping/ci/mapping.txt
# Release master branch
canary:
needs: build
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master'
steps:
- uses: actions/download-artifact@v3
with:
name: apk
- name: Rename apk
run: mv app-ci.apk io.github.fate_grand_automata.apk
- id: create_release
uses: marvinpinto/action-automatic-releases@latest
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "canary"
prerelease: true
title: 'FGA canary-${{ github.run_number }}'
files: |
*.apk
play_store:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master' && inputs.release-playstore != 'false'
steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: ${{ env.JAVA_VERSION }}
distribution: ${{ env.JAVA_DISTRO }}
cache: 'gradle'
- name: Determine Version Name
shell: bash
run: |
VERSION_CODE=${{ github.run_number }}
VERSION_NAME=${{ github.run_number }}
if [[ ${{ github.ref }} == refs/tags/* ]]; then
VERSION_NAME = ${{ github.ref_name }}
fi
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@v3
with:
name: bundle
path: app/build/outputs/bundle/release/app-release.aab
- name: Upload De-obfuscation mapping file
uses: actions/upload-artifact@v3
with:
name: mapping-release
path: app/build/outputs/mapping/release/mapping.txt