Skip to content

Commit 3e4ed47

Browse files
authored
feat: Added reusable-android-demo-shop-publish.yaml (#242)
* feat: Added reusable-android-demo-shop-publish.yaml * feat: Added decoding file from json and rename flow * feat: Added decoding of Google Play service account JSON and output playJson for subsequent steps * feat: Replaced deprecated set-output syntax with method using GITHUB_OUTPUT
1 parent dc258da commit 3e4ed47

File tree

1 file changed

+106
-0
lines changed

1 file changed

+106
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
name: Reusable Android Demo Shop Publish
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
packageName:
7+
required: true
8+
type: string
9+
releaseFiles:
10+
required: true
11+
type: string
12+
PROPERTIES_FILE:
13+
required: true
14+
type: string
15+
secrets:
16+
PLAY_ACCOUNT_AS_BASE64:
17+
required: true
18+
KEYSTORE_AS_BASE64:
19+
required: true
20+
SIGNING_STORE_PASSWORD:
21+
required: true
22+
SIGNING_KEY_ALIAS:
23+
required: true
24+
SIGNING_KEY_PASSWORD:
25+
required: true
26+
GITHUB_APP_ID:
27+
required: true
28+
GITHUB_APP_PRIVATE_KEY:
29+
required: true
30+
31+
jobs:
32+
publish_and_version_bump:
33+
runs-on: ubuntu-latest
34+
35+
steps:
36+
- uses: actions/create-github-app-token@v1
37+
id: app-token
38+
with:
39+
app-id: ${{ secrets.GITHUB_APP_ID }}
40+
private-key: ${{ secrets.GITHUB_APP_PRIVATE_KEY }}
41+
42+
- name: Checkout repository
43+
uses: actions/checkout@v4
44+
with:
45+
token: ${{ steps.app-token.outputs.token }}
46+
47+
- name: Set up JDK 20
48+
uses: actions/setup-java@v4
49+
with:
50+
java-version: '20'
51+
distribution: 'zulu'
52+
53+
- name: Create Keystore file
54+
run: |
55+
echo "${{ secrets.KEYSTORE_AS_BASE64 }}" | base64 --decode > app/keystore.jks
56+
57+
- name: Decode Google Play service account JSON
58+
id: decode
59+
run: |
60+
echo "${{ secrets.PLAY_ACCOUNT_AS_BASE64 }}" | base64 --decode > google-play-service-account.json
61+
playJson=$(cat google-play-service-account.json)
62+
echo "playJson=$playJson" >> $GITHUB_OUTPUT
63+
64+
# Building release bundle
65+
- name: Build Release AAB
66+
run: ./gradlew bundleProdRelease
67+
env:
68+
SIGNING_STORE_FILE: app/keystore.jks
69+
SIGNING_STORE_PASSWORD: ${{ secrets.SIGNING_STORE_PASSWORD }}
70+
SIGNING_KEY_ALIAS: ${{ secrets.SIGNING_KEY_ALIAS }}
71+
SIGNING_KEY_PASSWORD: ${{ secrets.SIGNING_KEY_PASSWORD }}
72+
73+
# Sending to Google Play
74+
- name: Deploy to Google Play Internal Testing
75+
uses: r0adkll/upload-google-play@v1
76+
with:
77+
serviceAccountJsonPlainText: ${{ steps.decode.outputs.playJson }}
78+
packageName: ${{ inputs.packageName }}
79+
releaseFiles: ${{ inputs.releaseFiles }}
80+
track: "internal"
81+
82+
# Increment version
83+
- name: Bump version
84+
run: ./gradlew incrementVersion
85+
env:
86+
PROPERTIES_FILE: ${{ inputs.PROPERTIES_FILE }}
87+
88+
# Getting new version
89+
- name: Retrieve new version
90+
id: versionName
91+
run: |
92+
version=$(grep "VERSION_NAME=" ${{ inputs.PROPERTIES_FILE }} | cut -d'=' -f2)
93+
echo "versionName=$version" >> $GITHUB_ENV
94+
echo "versionName=$version" >> $GITHUB_OUTPUT
95+
96+
# Commit changes
97+
- name: Commit changes
98+
id: committer
99+
uses: planetscale/ghcommit-action@v0.1.44
100+
env:
101+
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
102+
with:
103+
repo: ${{ github.repository }}
104+
branch: master
105+
commit_message: 'chore: bump version to ${{ steps.versionName.outputs.versionName }}'
106+
file_pattern: ${{ inputs.PROPERTIES_FILE }}

0 commit comments

Comments
 (0)