Remove .DS_Store and add to .gitignore #47
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Android CI/CD Pipeline | |
on: | |
pull_request: | |
branches: [ "main" ] | |
workflow_dispatch: | |
push: | |
tags: | |
- "v*" | |
jobs: | |
build_and_test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Create local.properties | |
run: | | |
echo "VERSION_NAME=${{ secrets.VERSION_NAME }}" >> local.properties | |
echo "VERSION_CODE=${{ secrets.VERSION_CODE }}" >> local.properties | |
echo "API_KEY=${{ secrets.API_KEY }}" >> local.properties | |
echo "BASE_URL=${{ secrets.BASE_URL }}" >> local.properties | |
echo "KEY_ALIAS=${{ secrets.KEY_ALIAS }}" >> local.properties | |
echo "KEY_PASSWORD=${{ secrets.KEY_PASSWORD }}" >> local.properties | |
echo "STORE_PASSWORD=${{ secrets.STORE_PASSWORD }}" >> local.properties | |
- name: Upload local.properties artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: local-properties | |
path: local.properties | |
- name: Decode google-services.json | |
run: | | |
echo "${{ secrets.GOOGLE_SERVICES_JSON }}" | base64 --decode > app/google-services.json | |
- name: Upload google-services.json artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: google-services.json | |
path: app/google-services.json | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
cache: 'gradle' | |
- name: Grant execute permissions | |
run: | | |
chmod +x ./gradlew | |
chmod +x ./deploy.sh | |
- name: Run Unit Tests and Lint | |
run: | | |
# First, run unit tests | |
./gradlew testDebugUnitTest | |
# Check if Lint baseline file exists | |
LINT_BASELINE=core/build/lint-baseline.xml | |
if [ ! -f "$LINT_BASELINE" ]; then | |
echo "Lint baseline does not exist. Creating baseline..." | |
# Run lintDebug; if it fails due to new baseline, ignore the error | |
./gradlew lintDebug || true | |
else | |
# Baseline exists, run lint normally | |
./gradlew lintDebug | |
fi | |
build_release: | |
needs: build_and_test | |
runs-on: ubuntu-latest | |
env: | |
STORE_PASSWORD: ${{ secrets.STORE_PASSWORD }} | |
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }} | |
KEY_ALIAS: ${{ secrets.KEY_ALIAS }} | |
GITHUB_TOKEN: ${{ secrets.RELEASE_PAT }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Bump version and push tag | |
id: version_bump | |
uses: anothrNick/github-tag-action@1.67.0 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
DEFAULT_BUMP: patch | |
WITH_V: true | |
- name: Set VERSION_NAME | |
run: echo "VERSION_NAME=${{ steps.version_bump.outputs.new_tag }}" >> $GITHUB_ENV | |
- name: Create local.properties | |
run: | | |
echo "VERSION_NAME=${{ env.VERSION_NAME }}" >> local.properties | |
echo "VERSION_CODE=${{ secrets.VERSION_CODE }}" >> local.properties | |
echo "API_KEY=${{ secrets.API_KEY }}" >> local.properties | |
echo "BASE_URL=${{ secrets.BASE_URL }}" >> local.properties | |
echo "KEY_ALIAS=${{ secrets.KEY_ALIAS }}" >> local.properties | |
echo "KEY_PASSWORD=${{ secrets.KEY_PASSWORD }}" >> local.properties | |
echo "STORE_PASSWORD=${{ secrets.STORE_PASSWORD }}" >> local.properties | |
- name: Decode google-services.json | |
run: | | |
echo "${{ secrets.GOOGLE_SERVICES_JSON }}" | base64 --decode > app/google-services.json | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
- name: Grant execute permission for gradlew | |
run: chmod +x ./gradlew | |
- name: Decode Keystore | |
run: echo "${{ secrets.RELEASE_KEYSTORE_BASE64 }}" | base64 --decode > app/release-keystore.jks | |
- name: Build Release App Bundle | |
run: ./gradlew bundleRelease | |
- name: Create GitHub Release | |
id: create_release | |
uses: actions/create-release@v1 | |
with: | |
tag_name: ${{ env.VERSION_NAME }} | |
release_name: Release ${{ env.VERSION_NAME }} | |
draft: false | |
prerelease: false | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Upload AAB to GitHub Release | |
uses: actions/upload-release-asset@v1 | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: app/build/outputs/bundle/release/app-release.aab | |
asset_name: app-${{ env.VERSION_NAME }}.aab | |
asset_content_type: application/octet-stream |