diff --git a/.github/workflows/versioning-and-deployment.yml b/.github/workflows/versioning-and-deployment.yml new file mode 100644 index 0000000..066a684 --- /dev/null +++ b/.github/workflows/versioning-and-deployment.yml @@ -0,0 +1,53 @@ +name: Versioning, Build And Deployment to Firebase App Distribution +on: + push: + branches: [ feat/cicd-firebase ] + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + env: + LOCAL_PROPERTIES_CONTENTS: ${{ secrets.LOCAL_PROPERTIES_CONTENTS }} + GOOGLE_SERVICES_JSON: ${{ secrets.GOOGLE_SERVICES_JSON }} + VERSION_CODE: ${{ github.run_number }} + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + distribution: 'corretto' + java-version: '17' + + - name: Grant execute permission for gradlew + run: chmod +x ./ThinkerBell/gradlew + + - name: Create google-services.json + run: echo "$GOOGLE_SERVICES_JSON" > ./ThinkerBell/presentation/google-services.json + + - name: Create local.properties + run: echo "$LOCAL_PROPERTIES_CONTENTS" > ./ThinkerBell/local.properties + + - name: Decode and save keystore + run: echo "${{ secrets.KEYSTORE_BASE64 }}" | base64 --decode > ./ThinkerBell/presentation/keystore.jks + + - name: Verify keystore + run: | + ls -alh ./ThinkerBell/presentation/ + echo "Checking JKS format..." + keytool -list -v -keystore ./ThinkerBell/presentation/keystore.jks -storetype JKS || echo "JKS format verification failed" + + - name: Build release APK + run: | + cd ./ThinkerBell + ./gradlew assembleRelease -PversionCode=$VERSION_CODE + + - name: Upload to Firebase App Distribution + uses: wzieba/Firebase-Distribution-Github-Action@v1 + with: + appId: ${{ secrets.FIREBASE_APP_ID }} + serviceCredentialsFileContent: ${{ secrets.CREDENTIAL_FILE_CONTENT }} + groups: Team-NeverLand + file: ./ThinkerBell/presentation/build/outputs/apk/release/ThinkerBell-release.apk