Merge pull request #9 from 3o14-com/iac #9
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 APK Build | |
on: | |
push: | |
branches: | |
- main | |
permissions: | |
contents: write | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node: [18.x] | |
steps: | |
- name: π Checkout repository | |
uses: actions/checkout@v3 | |
- name: π Setup Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node }} | |
cache: npm | |
cache-dependency-path: 3o14/package-lock.json | |
- name: π Setup Expo and EAS | |
uses: expo/expo-github-action@v7 | |
with: | |
token: ${{ secrets.EXPO_TOKEN }} | |
expo-version: latest | |
eas-version: latest | |
- name: π¦ Install dependencies | |
run: npm install | |
working-directory: 3o14 | |
- name: π Setup Java 17 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
# β Decode and Save Keystore Securely | |
- name: π‘οΈ Decode and Prepare Keystore | |
run: | | |
mkdir -p 3o14/android/keystores | |
echo "${{ secrets.ANDROID_KEYSTORE_BASE64 }}" | base64 -d > 3o14/android/keystores/release.keystore | |
# β Generate credentials.json with Secrets | |
- name: π‘οΈ Generate credentials.json | |
run: | | |
echo '{ | |
"android": { | |
"keystore": { | |
"keystorePath": "android/keystores/release.keystore", | |
"keystorePassword": "${{ secrets.ANDROID_KEYSTORE_PASSWORD }}", | |
"keyAlias": "${{ secrets.ANDROID_KEY_ALIAS }}", | |
"keyPassword": "${{ secrets.ANDROID_KEY_PASSWORD }}" | |
} | |
} | |
}' > 3o14/credentials.json | |
- name: π Extract Version from app.json | |
id: get_version | |
run: echo "version=$(jq -r '.expo.version' 3o14/app.json)" >> $GITHUB_ENV | |
- name: π· Build APK | |
run: | | |
eas build --local \ | |
--non-interactive \ | |
--output=./3o14.apk \ | |
--platform=android \ | |
--profile=production | |
working-directory: 3o14 | |
- name: π Upload APK to GitHub Releases | |
uses: ncipollo/release-action@v1 | |
with: | |
artifacts: 3o14/3o14.apk | |
tag: v${{ env.version }} | |
name: 3o14 v${{ env.version }} | |
body: "Automated build for version ${{ env.version }}" | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: β Clean up build artifacts and credentials | |
run: | | |
rm -rf 3o14/3o14.apk | |
rm -rf 3o14/android/keystores/release.keystore | |
rm -rf 3o14/credentials.json |