Merge branch 'feature/JP-Cache' into develop #6
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 Weather App CI | |
on: | |
push: | |
branches: | |
- develop | |
- main | |
pull_request: | |
branches: | |
- develop | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
cache: 'gradle' | |
- name: Set up Gradle cache | |
uses: actions/cache@v2 | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties', '**/buildSrc/**/*.kt') }} | |
- name: Grant execute permission for gradlew | |
run: chmod +x gradlew | |
- name: Update local.properties | |
run: | | |
echo "WEATHER_KEY=${{ secrets.WEATHER_KEY }}" >> local.properties | |
echo "SHARED_PREFERENCES_NAME=${{ secrets.SHARED_PREFERENCES_NAME }}" >> local.properties | |
echo "BASE_URL=${{ secrets.BASE_URL }}" >> local.properties | |
- name: Execute validations | |
run: ./gradlew executeValidations | |
- name: Build App | |
run: | | |
if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then | |
./gradlew assembleRelease | |
else | |
./gradlew assembleDebug | |
fi | |
- name: Upload APK artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: app-${{ github.ref == 'refs/heads/main' && 'release' || 'debug' }} | |
path: app/build/outputs/apk/${{ github.ref == 'refs/heads/main' && 'release' || 'debug' }}/app-${{ github.ref == 'refs/heads/main' && 'release' || 'debug' }}.apk |