Android CI/CD #27
Workflow file for this run
This file contains 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 | |
on: | |
push: | |
tags: | |
- "v*.*.*" # Triggers only on tag pushes matching the pattern | |
jobs: | |
deploy: | |
name: Build and Deploy to Google Play | |
runs-on: ubuntu-latest | |
if: startsWith(github.ref, 'refs/tags/') | |
env: | |
JAVA_HOME: /usr/lib/jvm/java-17-openjdk-amd64 | |
LANG: en_US.UTF-8 | |
LC_ALL: en_US.UTF-8 | |
steps: | |
# 1. Checkout Repository | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
# 2. Set up JDK 17 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: "temurin" | |
java-version: "17" | |
# 3. Set up Node.js | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "20" | |
# 4. Setup pnpm | |
- name: Setup pnpm | |
uses: pnpm/action-setup@v4 | |
with: | |
version: 9 | |
run_install: false | |
# 5. Cache pnpm store | |
- name: Cache pnpm store | |
uses: actions/cache@v3 | |
with: | |
path: ~/.pnpm-store | |
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pnpm-store- | |
# 6. Configure pnpm store | |
- name: Configure pnpm store | |
run: pnpm config set store-dir ~/.pnpm-store | |
# 7. Install Dependencies | |
- name: Install Dependencies | |
run: pnpm install | |
# 8. Build Project | |
- name: Build Project | |
run: pnpm build | |
# 9. Set up Android SDK | |
- name: Set up Android SDK | |
uses: android-actions/setup-android@v3 | |
# 10. Decrypt and Extract signing.tar.enc | |
- name: Decrypt and Extract signing.tar.enc | |
env: | |
SIGNING_KEY_PASSWORD: ${{ secrets.SIGNING_KEY_PASSWORD }} | |
run: | | |
openssl enc -aes-256-cbc -pbkdf2 -iter 100000 \ | |
-d -in signing.tar.enc -out signing.tar \ | |
-pass pass:"$SIGNING_KEY_PASSWORD" | |
tar xvf signing.tar | |
working-directory: sidekick | |
# 11. Verify Decryption | |
- name: Verify Decryption | |
run: ls -la | |
working-directory: sidekick | |
# 12. Configure Keystore | |
- name: Configure Keystore | |
run: | | |
mkdir -p ~/.android | |
cp keystore.properties ~/.android/keystore.properties | |
cp android-keystore.jks ~/.android/android-keystore.jks | |
working-directory: sidekick | |
# 13. Cache Gradle packages | |
- name: Cache Gradle packages | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper/ | |
key: > | |
${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | |
restore-keys: | | |
${{ runner.os }}-gradle- | |
# 14. Make gradlew Executable | |
- name: Make gradlew Executable | |
run: chmod +x ./gradlew | |
working-directory: sidekick | |
# 15. Set up Ruby | |
- name: Set up Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: "3.0" # Specify the Ruby version you need | |
bundler-cache: true # Automatically caches gems | |
# 16. Build and Deploy with Fastlane | |
- name: Build and Deploy with Fastlane | |
working-directory: sidekick # Directory containing Fastfile | |
run: bundle exec fastlane alpha |