Skip to content
Merged
Show file tree
Hide file tree
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
79 changes: 16 additions & 63 deletions .github/workflows/build_apk.yaml
Original file line number Diff line number Diff line change
@@ -1,70 +1,23 @@
name: Build APK

on:
workflow_run:
workflows:
- "Publish to Play Store and Bump Version"
pull_request:
types:
- completed
- closed
branches:
- master
workflow_dispatch:

jobs:
build_release_apk:
runs-on: ubuntu-latest
steps:
- uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ vars.PUBLIVERSIONER_ID }}
private-key: ${{ secrets.PUBLIVERSIONER_SECRET }}

- name: Checkout repository
uses: actions/checkout@v4

- name: Get current version from source
env:
FILE_PATH: "version.properties"
id: version_source
run: |
current_version=$(awk -F"=" '/VERSION_NAME/ {print $2}' "$FILE_PATH")
echo "version=$current_version" >> $GITHUB_OUTPUT

- name: Decode and create google-services.json
run: |
mkdir -p app/src/prod/release
echo "$GOOGLE_SERVICES_JSON" | base64 -d > app/src/prod/release/google-services.json
env:
GOOGLE_SERVICES_JSON: ${{ secrets.GOOGLE_SERVICES_FILE_AS_BASE64 }}

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

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

- name: Build Release APK
run: ./gradlew assembleProdRelease
env:
SIGNING_STORE_FILE: ${{ github.workspace }}/app/keystore.jks
SIGNING_STORE_PASSWORD: ${{ secrets.RELEASE_STORE_PASSWORD }}
SIGNING_KEY_ALIAS: ${{ secrets.RELEASE_KEY_ALIAS }}
SIGNING_KEY_PASSWORD: ${{ secrets.RELEASE_KEY_PASSWORD }}

- name: Prepare release directory
run: |
mkdir -p release
cp app/build/outputs/apk/prod/release/app-prod-release.apk release/

- name: Create release
env:
TAG: ${{ steps.version_source.outputs.version }}
GH_TOKEN: ${{ steps.app-token.outputs.token }}
run: |
gh release create "v$TAG" ./release/app-prod-release.apk \
--title=$TAG \
--generate-notes
if: github.event_name == 'workflow_dispatch' || (github.event_name == 'pull_request' && github.event.pull_request.merged == true && startsWith(github.event.pull_request.head.ref, 'release/'))
uses: rees46/workflow/.github/workflows/reusable-android-release-apk.yaml@master
with:
appId: ${{ vars.PUBLIVERSIONER_ID }}
secrets:
appSecret: ${{ secrets.PUBLIVERSIONER_SECRET }}
googleServicesFileAsBase64: ${{ secrets.GOOGLE_SERVICES_FILE_AS_BASE64 }}
googlePlaySigningKeyFileAsBase64: ${{ secrets.GOOGLE_PLAY_SIGNING_KEY_FILE_AS_BASE64 }}
releaseStorePassword: ${{ secrets.RELEASE_STORE_PASSWORD }}
releaseKeyAlias: ${{ secrets.RELEASE_KEY_ALIAS }}
releaseKeyPassword: ${{ secrets.RELEASE_KEY_PASSWORD }}
4 changes: 4 additions & 0 deletions .github/workflows/constants/replacements.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ ignore:
- app/src/main/res/drawable/ic_app.xml
- app/src/main/res/drawable/ic_logo.xml
replacements:
- from: "publish.yaml.bak"
to: "publish.yaml"
- from: "PUBLIVERSIONER_SECRET"
to: "PERSONACLICK_COURIER_SECRET"
- from: "PUBLIVERSIONER_ID"
Expand All @@ -28,6 +30,8 @@ replacements:
to: https://api.personaclick.com/
- from: com.rees46:rees46-sdk
to: com.personaclick:personaclick-sdk
- from: api.rees46.ru
to: api.personaclick.com
- from: api.rees46.com
to: api.personaclick.com
- from: rees46.com
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
name: Publish to Play Store and Bump Version
name: Publish to Play Store

on:
pull_request:
types:
- closed
branches:
- master
workflow_dispatch:

jobs:
publish_and_version_bump:
uses: rees46/workflow/.github/workflows/reusable-android-google-play-publish.yaml@master
google-play-publish:
if: github.event_name == 'workflow_dispatch' || (github.event_name == 'pull_request' && github.event.pull_request.merged == true && startsWith(github.event.pull_request.head.ref, 'release/'))
uses: rees46/workflow/.github/workflows/reusable-android-google-play-publish.yaml@1cfee7e2e762eed3a3d7d67c413aa0bae7f5ffae
with:
githubAppId: ${{ vars.PUBLIVERSIONER_ID }}
packageName: "rees46.demo_shop"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/repo-sync.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:

jobs:
prepare:
if: github.event.pull_request.merged == true || github.event_name == 'workflow_dispatch'
if: github.event_name == 'workflow_dispatch' || (github.event_name == 'pull_request' && github.event.pull_request.merged == true && startsWith(github.event.pull_request.head.ref, 'release/'))
runs-on: ubuntu-latest
outputs:
replacements: ${{ steps.getReplacementsStep.outputs.replacements }}
Expand Down
21 changes: 21 additions & 0 deletions .github/workflows/version.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Bump version

on:
push:
branches:
- master
paths-ignore:
- ".github/**"
- "version.properties"
workflow_dispatch:

jobs:
bump-version:
if: github.event_name == 'workflow_dispatch' || (github.event_name == 'pull_request' && github.event.pull_request.merged == true && !startsWith(github.event.pull_request.head.ref, 'release/'))
uses: rees46/workflow/.github/workflows/reusable-multiplatform-version-bump.yaml@master
permissions: write-all
secrets:
appSecret: ${{ secrets.PUBLIVERSIONER_SECRET }}
with:
appId: ${{ vars.PUBLIVERSIONER_ID }}
reviewerUsername: iwwwanow
19 changes: 19 additions & 0 deletions .releaserc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
branches: ["master"],
plugins:
[
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
[
"@semantic-release/git",
{
"assets": ["version.properties"],
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}",
},
],
[
"@semantic-release/exec",
{ "prepareCmd": "./scripts/update_version.sh ${nextRelease.version}" },
],
],
}
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ REES46 Demo Android - application to demonstrate working with SDK.
## Configure

Versions:

- REES46 SDK 2.0.20
- Java 20
- Kotlin 2.0.0
Expand Down
13 changes: 13 additions & 0 deletions scripts/update_version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

NEW_VERSION=$1

CURRENT_CODE=$(grep 'VERSION_CODE=' version.properties | cut -d'=' -f2)
NEW_VERSION_CODE=$((CURRENT_CODE + 1))

VERSION_NAME="$NEW_VERSION"

echo "VERSION_CODE=$NEW_VERSION_CODE" > version.properties
echo "VERSION_NAME=$VERSION_NAME" >> version.properties

echo "Updated iOS version to $VERSION_NAME ($NEW_VERSION_CODE)"