Skip to content

[Oztechan/CCC#3404] Move project to Setup Gradle Repo from Global repo #87

[Oztechan/CCC#3404] Move project to Setup Gradle Repo from Global repo

[Oztechan/CCC#3404] Move project to Setup Gradle Repo from Global repo #87

Workflow file for this run

name: Deployment
on:
push:
branches:
- master
env:
BASE_URL_BACKEND: ${{ secrets.BASE_URL_BACKEND }}
BASE_URL_API: ${{ secrets.BASE_URL_API }}
BASE_URL_API_PREMIUM: ${{ secrets.BASE_URL_API_PREMIUM }}
API_KEY_PREMIUM: ${{ secrets.API_KEY_PREMIUM }}
ANDROID_KEY_STORE_PATH: ${{ secrets.ANDROID_KEY_STORE_PATH }}
ANDROID_STORE_PASSWORD: ${{ secrets.ANDROID_STORE_PASSWORD }}
ANDROID_KEY_ALIAS: ${{ secrets.ANDROID_KEY_ALIAS }}
ANDROID_KEY_PASSWORD: ${{ secrets.ANDROID_KEY_PASSWORD }}
RELEASE_ADVERTISEMENT_ID_GOOGLE: ${{ secrets.RELEASE_ADVERTISEMENT_ID_GOOGLE }}
DEBUG_ADVERTISEMENT_ID_GOOGLE: ${{ secrets.DEBUG_ADVERTISEMENT_ID_GOOGLE }}
RELEASE_ADVERTISEMENT_ID_HUAWEI: ${{ secrets.RELEASE_ADVERTISEMENT_ID_HUAWEI }}
DEBUG_ADVERTISEMENT_ID_HUAWEI: ${{ secrets.DEBUG_ADVERTISEMENT_ID_HUAWEI }}
GOOGLE_BANNER_AD_UNIT_ID_CALCULATOR_RELEASE: ${{ secrets.GOOGLE_BANNER_AD_UNIT_ID_CALCULATOR_RELEASE }}
GOOGLE_BANNER_AD_UNIT_ID_SETTINGS_RELEASE: ${{ secrets.GOOGLE_BANNER_AD_UNIT_ID_SETTINGS_RELEASE }}
GOOGLE_BANNER_AD_UNIT_ID_CURRENCIES_RELEASE: ${{ secrets.GOOGLE_BANNER_AD_UNIT_ID_CURRENCIES_RELEASE }}
GOOGLE_INTERSTITIAL_AD_ID_RELEASE: ${{ secrets.GOOGLE_INTERSTITIAL_AD_ID_RELEASE }}
GOOGLE_REWARDED_AD_UNIT_ID_RELEASE: ${{ secrets.GOOGLE_REWARDED_AD_UNIT_ID_RELEASE }}
GOOGLE_BANNER_AD_UNIT_ID_CALCULATOR_DEBUG: ${{ secrets.GOOGLE_BANNER_AD_UNIT_ID_CALCULATOR_DEBUG }}
GOOGLE_BANNER_AD_UNIT_ID_SETTINGS_DEBUG: ${{ secrets.GOOGLE_BANNER_AD_UNIT_ID_SETTINGS_DEBUG }}
GOOGLE_BANNER_AD_UNIT_ID_CURRENCIES_DEBUG: ${{ secrets.GOOGLE_BANNER_AD_UNIT_ID_CURRENCIES_DEBUG }}
GOOGLE_INTERSTITIAL_AD_ID_DEBUG: ${{ secrets.GOOGLE_INTERSTITIAL_AD_ID_DEBUG }}
GOOGLE_REWARDED_AD_UNIT_ID_DEBUG: ${{ secrets.GOOGLE_REWARDED_AD_UNIT_ID_DEBUG }}
HUAWEI_BANNER_AD_UNIT_ID_CALCULATOR_RELEASE: ${{ secrets.HUAWEI_BANNER_AD_UNIT_ID_CALCULATOR_RELEASE }}
HUAWEI_BANNER_AD_UNIT_ID_SETTINGS_RELEASE: ${{ secrets.HUAWEI_BANNER_AD_UNIT_ID_SETTINGS_RELEASE }}
HUAWEI_BANNER_AD_UNIT_ID_CURRENCIES_RELEASE: ${{ secrets.HUAWEI_BANNER_AD_UNIT_ID_CURRENCIES_RELEASE }}
HUAWEI_INTERSTITIAL_AD_ID_RELEASE: ${{ secrets.HUAWEI_INTERSTITIAL_AD_ID_RELEASE }}
HUAWEI_REWARDED_AD_UNIT_ID_RELEASE: ${{ secrets.HUAWEI_REWARDED_AD_UNIT_ID_RELEASE }}
HUAWEI_BANNER_AD_UNIT_ID_CALCULATOR_DEBUG: ${{ secrets.HUAWEI_BANNER_AD_UNIT_ID_CALCULATOR_DEBUG }}
HUAWEI_BANNER_AD_UNIT_ID_SETTINGS_DEBUG: ${{ secrets.HUAWEI_BANNER_AD_UNIT_ID_SETTINGS_DEBUG }}
HUAWEI_BANNER_AD_UNIT_ID_CURRENCIES_DEBUG: ${{ secrets.HUAWEI_BANNER_AD_UNIT_ID_CURRENCIES_DEBUG }}
HUAWEI_INTERSTITIAL_AD_ID_DEBUG: ${{ secrets.HUAWEI_INTERSTITIAL_AD_ID_DEBUG }}
HUAWEI_REWARDED_AD_UNIT_ID_DEBUG: ${{ secrets.HUAWEI_REWARDED_AD_UNIT_ID_DEBUG }}
APP_STORE_CONNECT_ISSUER_ID: ${{ secrets.APP_STORE_CONNECT_ISSUER_ID }}
APP_STORE_CONNECT_KEY_CONTENT: ${{ secrets.APP_STORE_CONNECT_KEY_CONTENT }}
APP_STORE_CONNECT_KEY_ID: ${{ secrets.APP_STORE_CONNECT_KEY_ID }}
IOS_GOOGLE_FIREBASE_APP_ID: ${{ secrets.IOS_GOOGLE_FIREBASE_APP_ID }}
FIREBASE_CLI_TOKEN: ${{ secrets.FIREBASE_CLI_TOKEN }}
GIT_AUTHORIZATION: ${{ secrets.GIT_AUTHORIZATION }}
SECRET_PASSWORD: ${{ secrets.SECRET_PASSWORD }}
MATCH_PASSWORD: ${{ secrets.SECRET_PASSWORD }}
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
FASTLANE_XCODEBUILD_SETTINGS_TIMEOUT: 5
FASTLANE_XCODEBUILD_SETTINGS_RETRIES: 5
CI: true
jobs:
GenerateGradleArtifacts:
runs-on: ubuntu-22.04
outputs:
status: ${{ steps.status.outputs.status }}
steps:
- name: Setup Gradle Repo
uses: Oztechan/Global/.github/workflows/[email protected]
- name: Adding secret files
run: |
echo "${{ secrets.ANDROID_GPG_RELEASE_KEYSTORE }}" > release.keystore.asc
gpg -d --passphrase "${{ secrets.SECRET_PASSWORD }}" --batch release.keystore.asc > android/app/release.keystore
mkdir android/app/src/release
echo "${{ secrets.RELEASE_GOOGLE_SERVICES_JSON_ASC }}" > google-services.json.asc
gpg -d --passphrase "${{ secrets.SECRET_PASSWORD }}" --batch google-services.json.asc > android/app/src/release/google-services.json
mkdir android/app/src/debug
echo "${{ secrets.DEBUG_GOOGLE_SERVICES_JSON_ASC }}" > google-services.json.asc
gpg -d --passphrase "${{ secrets.SECRET_PASSWORD }}" --batch google-services.json.asc > android/app/src/debug/google-services.json
echo "${{ secrets.AG_CONNECT_SERVICES_JSON_ASC }}" > agconnect-services.json.asc
gpg -d --passphrase "${{ secrets.SECRET_PASSWORD }}" --batch agconnect-services.json.asc > android/app/src/release/agconnect-services.json
- name: Generate Artifacts
run: ./gradlew :android:app:bundleRelease :backend:app:jar --parallel
- name: Upload Google App Bundle
uses: actions/[email protected]
with:
name: googleBundle
path: android/app/build/outputs/bundle/googleRelease/app-google-release.aab
- name: Upload Huawei App Bundle
uses: actions/[email protected]
with:
name: huaweiBundle
path: android/app/build/outputs/bundle/huaweiRelease/app-huawei-release.aab
- name: Upload Backend Jar
uses: actions/[email protected]
with:
name: backendJar
path: backend/app/build/libs/app-*.jar
- name: Set Job Status
id: status
run: echo "status=success" >> $GITHUB_OUTPUT
UploadToGooglePlay:
runs-on: ubuntu-22.04
needs: [ GenerateGradleArtifacts ]
outputs:
status: ${{ steps.status.outputs.status }}
steps:
- name: Download App Bundle
uses: actions/[email protected]
with:
name: googleBundle
- name: Adding secret files
run: |
echo "${{ secrets.GOOGLE_PLAY_SERVICE_ACCOUNT_JSON }}" > service_account.json.asc
gpg -d --passphrase "${{ secrets.SECRET_PASSWORD }}" --batch service_account.json.asc > service_account.json
- name: Upload Artifact to Google Play Console
uses: r0adkll/[email protected]
with:
serviceAccountJson: service_account.json
packageName: mustafaozhan.github.com.mycurrencies
releaseFiles: app-google-release.aab
track: internal
status: completed
- name: Delete App Bundle
uses: geekyeggo/[email protected]
with:
name: googleBundle
- name: Set Job Status
id: status
run: echo "status=success" >> $GITHUB_OUTPUT
UploadToHuaweiAppGallery:
runs-on: ubuntu-22.04
needs: [ GenerateGradleArtifacts ]
outputs:
status: ${{ steps.status.outputs.status }}
steps:
- name: Download App Bundle
uses: actions/[email protected]
with:
name: huaweiBundle
- name: Deploy to Huawei App Gallery
uses: muhamedzeema/appgallery-deply-action@main
with:
client-id: ${{secrets.HUAWEI_CLIENT_ID}}
client-key: ${{secrets.HUAWEI_CLIENT_KEY}}
app-id: ${{secrets.HUAWEI_APP_ID}}
file-extension: "aab"
file-path: "app-huawei-release.aab"
file-name: "app-huawei-release"
- name: Delete App Bundle
uses: geekyeggo/[email protected]
with:
name: huaweiBundle
- name: Set Job Status
id: status
run: echo "status=success" >> $GITHUB_OUTPUT
DeployToServer:
runs-on: ubuntu-22.04
needs: [ GenerateGradleArtifacts ]
outputs:
status: ${{ steps.status.outputs.status }}
steps:
- name: Download Backend Jar
uses: actions/[email protected]
with:
name: backendJar
path: artifact
- name: Deploy to Server
uses: easingthemes/[email protected]
env:
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
REMOTE_HOST: ${{ secrets.REMOTE_HOST }}
REMOTE_USER: ${{ secrets.REMOTE_USER }}
TARGET: ${{ secrets.REMOTE_TARGET }}
SOURCE: "artifact/"
- name: Delete Backend Jar
uses: geekyeggo/[email protected]
with:
name: backendJar
- name: Set Job Status
id: status
run: echo "status=success" >> $GITHUB_OUTPUT
UploadToAppStore:
runs-on: macos-13
outputs:
status: ${{ steps.status.outputs.status }}
steps:
- name: Setup Gradle Repo
uses: Oztechan/Global/.github/workflows/[email protected]
- name: Adding secret files
run: |
echo "${{ secrets.IOS_GPG_FIREBASE_CONFIG }}" > GoogleService-Info.plist.asc
mkdir ios/CCC/Resources/Release
gpg -d --passphrase "${{ secrets.SECRET_PASSWORD }}" --batch GoogleService-Info.plist.asc > ios/CCC/Resources/Release/GoogleService-Info.plist
rm ios/CCC/Resources/Debug/GoogleService-Info.plist
echo "${{ secrets.IOS_GPG_RELEASE_XCCONFIG }}" > Release.xcconfig.asc
gpg -d --passphrase "${{ secrets.SECRET_PASSWORD }}" --batch Release.xcconfig.asc > ios/CCC/Resources/Release/Config.xcconfig
- name: StoreBuild
working-directory: ios
run: fastlane store_build
- name: Set Job Status
id: status
run: echo "status=success" >> $GITHUB_OUTPUT
Notify:
runs-on: ubuntu-22.04
needs: [ GenerateGradleArtifacts, UploadToGooglePlay, UploadToHuaweiAppGallery, DeployToServer, UploadToAppStore ]
if: always()
steps:
- name: Notify slack success
if: needs.GenerateGradleArtifacts.outputs.status == 'success' &&
needs.UploadToGooglePlay.outputs.status == 'success' &&
needs.UploadToHuaweiAppGallery.outputs.status == 'success' &&
needs.DeployToServer.outputs.status == 'success' &&
needs.UploadToAppStore.outputs.status == 'success'
uses: voxmedia/[email protected]
with:
channel: ccc-github
status: SUCCESS
color: good
- name: Notify slack fail
if: false == (needs.GenerateGradleArtifacts.outputs.status == 'success') ||
false == (needs.UploadToGooglePlay.outputs.status == 'success') ||
false == (needs.UploadToHuaweiAppGallery.outputs.status == 'success') ||
false == (needs.DeployToServer.outputs.status == 'success') ||
false == (needs.UploadToAppStore.outputs.status == 'success')
uses: voxmedia/[email protected]
with:
channel: ccc-github
status: FAILED
color: danger