change dir #13
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: | |
branches: | |
- next | |
tags: | |
- "v*.*.*" | |
pull_request: | |
branches: | |
- next | |
jobs: | |
build: | |
name: Build and Test | |
runs-on: ubuntu-latest | |
env: | |
JAVA_HOME: /usr/lib/jvm/java-17-openjdk-amd64 | |
LANG: en_US.UTF-8 | |
LC_ALL: en_US.UTF-8 | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: "temurin" | |
java-version: "17" | |
- uses: pnpm/action-setup@v4 | |
name: Install pnpm | |
with: | |
version: 9 | |
run_install: false | |
- name: Install Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: "pnpm" | |
- name: Install dependencies | |
run: pnpm install | |
- name: Configure pnpm store | |
run: pnpm config set store-dir ~/.pnpm-store | |
- name: Install Dependencies | |
run: pnpm install | |
- name: Build Project | |
run: pnpm build | |
- name: Set up Android SDK | |
uses: android-actions/setup-android@v3 | |
- name: Decrypt and Extract signing.tar.enc | |
env: | |
SIGNING_KEY_PASSWORD: ${{ secrets.SIGNING_KEY_PASSWORD }} | |
run: | | |
cd sidekick | |
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 | |
- name: Configure Keystore | |
run: | | |
mkdir -p ~/.android | |
cp sidekick/keystore.properties ~/.android/keystore.properties | |
- 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- | |
- name: Build Release | |
run: | | |
cd sidekick | |
./gradlew assembleRelease | |
deploy: | |
name: Deploy to Google Play | |
needs: build | |
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: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: "temurin" | |
java-version: "17" | |
- uses: pnpm/action-setup@v4 | |
name: Install pnpm | |
with: | |
version: 9 | |
run_install: false | |
- name: Install Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: "pnpm" | |
- name: Configure pnpm store | |
run: pnpm config set store-dir ~/.pnpm-store | |
- name: Install Dependencies | |
run: pnpm install | |
- name: Build Project | |
run: pnpm build | |
- name: Set up Android SDK | |
uses: android-actions/setup-android@v3 | |
- name: Decrypt and Extract signing.tar.enc | |
env: | |
SIGNING_KEY_PASSWORD: ${{ secrets.SIGNING_KEY_PASSWORD }} | |
run: | | |
cd sidekick | |
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 | |
- name: Configure Keystore | |
run: | | |
mkdir -p ~/.android | |
cp sidekick/keystore.properties ~/.android/keystore.properties | |
- name: Install Fastlane | |
run: sudo gem install fastlane | |
- name: Set up Fastlane Environment Variables | |
env: | |
GOOGLE_APPLICATION_CREDENTIALS: ${{ github.workspace }}/api.json | |
run: | | |
echo "GOOGLE_PLAY_JSON_KEY=api.json" >> $GITHUB_ENV | |
- name: Build and Deploy with Fastlane | |
run: | | |
cd sidekick | |
fastlane alpha |