Skip to content

chore: bump version to 1.0.16 #8

chore: bump version to 1.0.16

chore: bump version to 1.0.16 #8

name: Build & Release to Google Play Store
on:
push:
tags:
- 'v*.*.*'
workflow_dispatch:
inputs:
track:
description: 'Play Store track'
required: true
default: 'internal'
type: choice
options:
- internal
- alpha
- beta
- production
build_number:
description: 'Build number (optional, auto-incremented if empty)'
required: false
type: string
env:
ANDROID_SDK_VERSION: 34
GRADLE_VERSION: 8.14.3
NODE_VERSION: 18
jobs:
setup:
name: Setup environment
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.version }}
build_number: ${{ steps.build_number.outputs.build_number }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get version from tag or app.json
id: version
run: |
if [[ $GITHUB_REF == refs/tags/* ]]; then
VERSION=${GITHUB_REF#refs/tags/v}
else
VERSION=$(jq -r '.expo.version' CB-Pro-Proxy/app.json)
fi
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "📦 Version: $VERSION"
- name: Generate build number
id: build_number
run: |
if [ -z "${{ github.event.inputs.build_number }}" ]; then
BUILD_NUMBER=$(date +%s)
else
BUILD_NUMBER=${{ github.event.inputs.build_number }}
fi
echo "build_number=$BUILD_NUMBER" >> $GITHUB_OUTPUT
echo "🔢 Build Number: $BUILD_NUMBER"
build:
name: Build AAB for Play Store
needs: setup
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: gradle
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: yarn
cache-dependency-path: 'CB-Pro-Proxy/yarn.lock'
- name: Setup Android SDK
uses: android-actions/setup-android@v3
with:
api-level: ${{ env.ANDROID_SDK_VERSION }}
ndk-version: '25.1.8937393'
- name: Install dependencies
working-directory: CB-Pro-Proxy
run: |
yarn install --frozen-lockfile
- name: Setup Fastlane
run: |
cd CB-Pro-Proxy/android
gem install bundler
bundle install
- name: Decode keystore
env:
KEYSTORE_BASE64: ${{ secrets.KEYSTORE_BASE64 }}
run: |
cd CB-Pro-Proxy/android
if [ -z "$KEYSTORE_BASE64" ]; then
echo "❌ KEYSTORE_BASE64 secret not found!"
exit 1
fi
echo $KEYSTORE_BASE64 | base64 -d > release.keystore
echo "✅ Keystore decoded"
- name: Build signed AAB
working-directory: CB-Pro-Proxy/android
env:
KEYSTORE_PATH: ${{ github.workspace }}/CB-Pro-Proxy/android/release.keystore
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
KEYSTORE_ALIAS: ${{ secrets.KEYSTORE_ALIAS }}
KEYSTORE_KEY_PASSWORD: ${{ secrets.KEYSTORE_KEY_PASSWORD }}
BUILD_NUMBER: ${{ needs.setup.outputs.build_number }}
VERSION_NAME: ${{ needs.setup.outputs.version }}
run: |
bundle exec fastlane android build_signed_aab
- name: Upload AAB artifact
uses: actions/upload-artifact@v4
with:
name: app-release-aab
path: CB-Pro-Proxy/app/build/outputs/bundle/release/app-release.aab
retention-days: 30
- name: Build APK for testing
working-directory: CB-Pro-Proxy/android
env:
KEYSTORE_PATH: ${{ github.workspace }}/CB-Pro-Proxy/android/release.keystore
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
KEYSTORE_ALIAS: ${{ secrets.KEYSTORE_ALIAS }}
KEYSTORE_KEY_PASSWORD: ${{ secrets.KEYSTORE_KEY_PASSWORD }}
run: |
bundle exec fastlane android build_signed_apk
- name: Upload APK artifact
uses: actions/upload-artifact@v4
with:
name: app-release-apk
path: CB-Pro-Proxy/app/build/outputs/apk/release/app-release.apk
retention-days: 30
screenshots:
name: Capture screenshots
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: gradle
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: yarn
cache-dependency-path: 'CB-Pro-Proxy/yarn.lock'
- name: Setup Android SDK
uses: android-actions/setup-android@v3
with:
api-level: ${{ env.ANDROID_SDK_VERSION }}
ndk-version: '25.1.8937393'
- name: Install dependencies
working-directory: CB-Pro-Proxy
run: yarn install --frozen-lockfile
- name: Setup Fastlane
working-directory: CB-Pro-Proxy/android
run: |
gem install bundler
bundle install
- name: Create Android emulator
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 34
arch: x86_64
force-avd-creation: true
emulator-boot-timeout: 660
disable-animations: true
disk-size: 2048M
heap-size: 512M
script: |
cd CB-Pro-Proxy
yarn install --frozen-lockfile
- name: Build debug APK for screenshots
working-directory: CB-Pro-Proxy/android
run: ./gradlew assembleDebug
- name: Install debug APK
run: |
adb install -r CB-Pro-Proxy/app/build/outputs/apk/debug/app-debug.apk
- name: Run screenshot automation
working-directory: CB-Pro-Proxy/android
run: |
# Install screenshot dependencies
gem install bundler
bundle install
# Create screenshots directory
mkdir -p fastlane/screenshots
# Run Screengrab for automated screenshots
bundle exec fastlane android capture_screenshots
- name: Upload screenshots artifact
uses: actions/upload-artifact@v4
with:
name: play-store-screenshots
path: CB-Pro-Proxy/android/fastlane/screenshots/
retention-days: 30
deploy:
name: Deploy to Google Play Store
needs: [setup, build, screenshots]
runs-on: ubuntu-latest
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') }} || ${{ github.event_name == 'workflow_dispatch' }}
timeout-minutes: 30
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
- name: Setup Fastlane
working-directory: CB-Pro-Proxy/android
run: |
gem install bundler
bundle install
- name: Download AAB artifact
uses: actions/download-artifact@v4
with:
name: app-release-aab
path: CB-Pro-Proxy/app/build/outputs/bundle/release/
- name: Download screenshots artifact
uses: actions/download-artifact@v4
with:
name: play-store-screenshots
path: CB-Pro-Proxy/android/fastlane/screenshots/
- name: Decode Play Store credentials
env:
PLAY_STORE_JSON_BASE64: ${{ secrets.PLAY_STORE_JSON_BASE64 }}
run: |
cd CB-Pro-Proxy/android
if [ -z "$PLAY_STORE_JSON_BASE64" ]; then
echo "❌ PLAY_STORE_JSON_BASE64 secret not found!"
exit 1
fi
echo $PLAY_STORE_JSON_BASE64 | base64 -d > google_play_key.json
echo "✅ Play Store credentials decoded"
- name: Determine release track
id: track
run: |
if [[ $GITHUB_REF == refs/tags/* ]]; then
TRACK="production"
else
TRACK="${{ github.event.inputs.track }}"
fi
echo "track=$TRACK" >> $GITHUB_OUTPUT
echo "🎯 Release Track: $TRACK"
- name: Upload to Google Play Store
working-directory: CB-Pro-Proxy/android
env:
ANDROID_JSON_KEY_DATA: ${{ secrets.PLAY_STORE_JSON_BASE64 }}
run: |
bundle exec fastlane android release_to_playstore track:${{ steps.track.outputs.track }} release_status:draft
- name: Create GitHub Release
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') }}
uses: softprops/action-gh-release@v1
with:
body: |
## Version ${{ needs.setup.outputs.version }}
### 📊 Build Information
- Build Number: ${{ needs.setup.outputs.build_number }}
- Track: production
### 🔗 Artifacts
- [app-release.aab](https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/app-release.aab)
- [app-release.apk](https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/app-release.apk)
✅ Successfully deployed to Google Play Store (Draft)
files: |
CB-Pro-Proxy/app/build/outputs/bundle/release/app-release.aab
CB-Pro-Proxy/app/build/outputs/apk/release/app-release.apk
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Notify Slack (optional)
if: always()
uses: slackapi/slack-github-action@v1
with:
webhook-url: ${{ secrets.SLACK_WEBHOOK_URL }}
payload: |
{
"text": "🎉 CB Pro VPN Release",
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*Version:* ${{ needs.setup.outputs.version }}\n*Build:* ${{ needs.setup.outputs.build_number }}\n*Status:* ${{ job.status }}"
}
}
]
}
test-release:
name: Test APK on emulator
needs: build
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
- name: Download APK artifact
uses: actions/download-artifact@v4
with:
name: app-release-apk
path: ./
- name: Run emulator and test
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 34
arch: x86_64
force-avd-creation: true
emulator-boot-timeout: 660
disable-animations: true
script: |
adb install -r app-release.apk
adb shell am start -n com.cbv.vpn/.MainActivity
sleep 5
echo "✅ App installed and launched successfully"
notify:
name: Notify completion
needs: [setup, build, deploy]
runs-on: ubuntu-latest
if: always()
steps:
- name: Job Status
run: |
echo "## 🎯 Build Status" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "- **Version:** ${{ needs.setup.outputs.version }}" >> $GITHUB_STEP_SUMMARY
echo "- **Build Number:** ${{ needs.setup.outputs.build_number }}" >> $GITHUB_STEP_SUMMARY
echo "- **Build Job:** ${{ needs.build.result }}" >> $GITHUB_STEP_SUMMARY
echo "- **Deploy Job:** ${{ needs.deploy.result }}" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "✅ All jobs completed successfully!" >> $GITHUB_STEP_SUMMARY