-
Notifications
You must be signed in to change notification settings - Fork 14
127 lines (107 loc) · 4.35 KB
/
Copy pathdeploy.yml
File metadata and controls
127 lines (107 loc) · 4.35 KB
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
name: Build & Deploy
on:
push:
tags:
- 'v*'
jobs:
build-and-deploy:
runs-on: ubuntu-latest
if: github.actor == 'dapoi'
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
cache: gradle
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Set up env.properties
run: |
echo "ADMOB_ID=${{ secrets.ADMOB_ID }}" >> env.properties
echo "AD_BANNER_UNIT_ID=${{ secrets.AD_BANNER_UNIT_ID }}" >> env.properties
echo "AD_INTERSTITIAL_UNIT_ID=${{ secrets.AD_INTERSTITIAL_UNIT_ID }}" >> env.properties
echo "API_KEY_DEBUG=${{ secrets.API_KEY_DEBUG }}" >> env.properties
echo "BASE_URL_DEBUG=${{ secrets.BASE_URL_DEBUG }}" >> env.properties
echo "BASE_URL_RELEASE=${{ secrets.BASE_URL_RELEASE }}" >> env.properties
- name: Decode Keystore
run: |
echo "${{ secrets.SIGNING_KEY_BASE64 }}" | base64 --decode > ${{ github.workspace }}/keystore.jks
- name: Build Release AAB & APK
env:
KEYSTORE_PATH: ${{ github.workspace }}/keystore.jks
KEY_STORE_PASSWORD: ${{ secrets.KEY_STORE_PASSWORD }}
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
run: |
VERSION_NAME="${{ github.ref_name }}"
VERSION_NAME="${VERSION_NAME#v}"
VERSION_CODE=$((20260701 + ${{ github.run_number }}))
echo "Building version $VERSION_NAME ($VERSION_CODE)"
./gradlew bundleRelease assembleRelease \
-PversionName="$VERSION_NAME" \
-PversionCode="$VERSION_CODE"
- name: Determine Flags
id: flags
run: |
git fetch --tags --force
if [[ "${{ github.ref_name }}" == *"-beta"* ]]; then
echo "track=beta" >> $GITHUB_OUTPUT
echo "prerelease=true" >> $GITHUB_OUTPUT
else
echo "track=production" >> $GITHUB_OUTPUT
echo "prerelease=false" >> $GITHUB_OUTPUT
fi
TAG_MESSAGE=$(git for-each-ref --format='%(contents)' "refs/tags/${{ github.ref_name }}")
echo "Debug: Tag name is ${{ github.ref_name }}"
echo "Debug: Tag message content: $TAG_MESSAGE"
if [[ "$TAG_MESSAGE" == *"upload_play_store=true"* ]]; then
echo "upload_play_store=true" >> $GITHUB_OUTPUT
else
echo "upload_play_store=false" >> $GITHUB_OUTPUT
fi
if [[ "$TAG_MESSAGE" == *"upload_github_release=true"* ]]; then
echo "upload_github_release=true" >> $GITHUB_OUTPUT
else
echo "upload_github_release=false" >> $GITHUB_OUTPUT
fi
- name: Prepare What's New
id: whatsnew
run: |
find distribution/whatsnew -type f -exec sed -i -E 's/^[0-9]+:- //g' {} +
NOTES_FILE="distribution/whatsnew/whatsnew-en-US"
if [ -f "$NOTES_FILE" ]; then
NOTES=$(cat "$NOTES_FILE")
else
NOTES="Release ${{ github.ref_name }}"
fi
echo "notes<<EOF" >> $GITHUB_OUTPUT
echo "$NOTES" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Upload to Play Store
if: steps.flags.outputs.upload_play_store == 'true'
uses: r0adkll/upload-google-play@v1
with:
serviceAccountJsonPlainText: ${{ secrets.SERVICE_ACCOUNT_JSON }}
packageName: com.dapascript.mever
releaseFiles: app/build/outputs/bundle/release/app-release.aab
track: ${{ steps.flags.outputs.track }}
status: completed
whatsNewDirectory: distribution/whatsnew
- name: Create GitHub Release
if: steps.flags.outputs.upload_github_release == 'true'
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.ref_name }}
name: ${{ github.ref_name }}
body: ${{ steps.whatsnew.outputs.notes }}
prerelease: ${{ steps.flags.outputs.prerelease }}
files: app/build/outputs/apk/release/app-release.apk
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}