Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Added reusable-android-demo-shop-publish.yaml #242

Merged
merged 5 commits into from
Oct 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
106 changes: 106 additions & 0 deletions .github/workflows/reusable-android-google-play-publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
name: Reusable Android Demo Shop Publish

on:
workflow_call:
inputs:
packageName:
required: true
type: string
releaseFiles:
required: true
type: string
PROPERTIES_FILE:
required: true
type: string
secrets:
PLAY_ACCOUNT_AS_BASE64:
required: true
KEYSTORE_AS_BASE64:
required: true
SIGNING_STORE_PASSWORD:
required: true
SIGNING_KEY_ALIAS:
required: true
SIGNING_KEY_PASSWORD:
required: true
GITHUB_APP_ID:
required: true
GITHUB_APP_PRIVATE_KEY:
required: true

jobs:
publish_and_version_bump:
runs-on: ubuntu-latest

steps:
- uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ secrets.GITHUB_APP_ID }}
private-key: ${{ secrets.GITHUB_APP_PRIVATE_KEY }}

- name: Checkout repository
uses: actions/checkout@v4
with:
token: ${{ steps.app-token.outputs.token }}

- name: Set up JDK 20
uses: actions/setup-java@v4
with:
java-version: '20'
distribution: 'zulu'

- name: Create Keystore file
run: |
echo "${{ secrets.KEYSTORE_AS_BASE64 }}" | base64 --decode > app/keystore.jks

- name: Decode Google Play service account JSON
id: decode
run: |
echo "${{ secrets.PLAY_ACCOUNT_AS_BASE64 }}" | base64 --decode > google-play-service-account.json
playJson=$(cat google-play-service-account.json)
echo "playJson=$playJson" >> $GITHUB_OUTPUT

# Building release bundle
- name: Build Release AAB
run: ./gradlew bundleProdRelease
env:
SIGNING_STORE_FILE: app/keystore.jks
SIGNING_STORE_PASSWORD: ${{ secrets.SIGNING_STORE_PASSWORD }}
SIGNING_KEY_ALIAS: ${{ secrets.SIGNING_KEY_ALIAS }}
SIGNING_KEY_PASSWORD: ${{ secrets.SIGNING_KEY_PASSWORD }}

# Sending to Google Play
- name: Deploy to Google Play Internal Testing
uses: r0adkll/upload-google-play@v1
with:
serviceAccountJsonPlainText: ${{ steps.decode.outputs.playJson }}
packageName: ${{ inputs.packageName }}
releaseFiles: ${{ inputs.releaseFiles }}
track: "internal"

# Increment version
- name: Bump version
run: ./gradlew incrementVersion
env:
PROPERTIES_FILE: ${{ inputs.PROPERTIES_FILE }}

# Getting new version
- name: Retrieve new version
id: versionName
run: |
version=$(grep "VERSION_NAME=" ${{ inputs.PROPERTIES_FILE }} | cut -d'=' -f2)
echo "versionName=$version" >> $GITHUB_ENV
echo "versionName=$version" >> $GITHUB_OUTPUT

# Commit changes
- name: Commit changes
id: committer
uses: planetscale/ghcommit-action@v0.1.44
env:
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
with:
repo: ${{ github.repository }}
branch: master
commit_message: 'chore: bump version to ${{ steps.versionName.outputs.versionName }}'
file_pattern: ${{ inputs.PROPERTIES_FILE }}