-
-
Save PabloCasia/bc2c9908df4803aafa804bc1be85b1a4 to your computer and use it in GitHub Desktop.
Android GitHub Actions Post
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
openssl base64 < playstore.keystore.jks | tr -d '\n' | tee keystore_base64_encoded.txt |
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: Build Release AAB | |
run: ./gradlew | |
-PKEYSTORE_FILE="../${{ /your_path_to/playstore.keystore.jks }}" | |
-PKEYSTORE_PASSWORD=${{ secrets.KEYSTORE_PASSWORD }} | |
-PSIGNING_KEY_ALIAS=${{ secrets.SIGNING_KEY_ALIAS }} | |
-PSIGNING_KEY_PASSWORD=${{ secrets.SIGNING_KEY_PASSWORD }} | |
app:bundleRelease |
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: Build Release AAB | |
run: ./gradlew app:bundleRelease |
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
buildTypes { | |
getByName("debug") { | |
// your configuration here | |
signingConfig = signingConfigs.getByName(name) | |
} | |
getByName("release") { | |
// your configuration here | |
signingConfig = signingConfigs.getByName(name) | |
} | |
} |
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
./gradlew bundle |
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: Run Linters and Test | |
run: ./gradlew check |
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: Deploy to Play Store | |
uses: r0adkll/upload-google-play@v1 | |
with: | |
serviceAccountJsonPlainText: ${{ secrets.SERVICE_ACCOUNT_JSON }} | |
packageName: your.app.package | |
releaseFiles: app/build/outputs/bundle/release/*.aab | |
track: internal |
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
storePassword = System.getenv("KEYSTORE_PASSWORD") |
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
KEYSTORE_FILE=/your_path_to/playstore.keystore.jks | |
KEYSTORE_PASSWORD=your_keystore_password | |
SIGNING_KEY_ALIAS=your_signing_key_alias | |
SIGNING_KEY_PASSWORD=your_signing_key_password |
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
# Cache Gradle dependencies and Gradle Wrapper | |
- name: Setup Gradle Cache | |
uses: actions/cache@v2 | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
key: ${{ runner.os }}-${{ hashFiles('**/*.gradle*') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}-${{ hashFiles('**/buildSrc/**/*.kt') }} | |
- name: Make gradlew executable | |
run: chmod +x ./gradlew |
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: "Gradle Wrapper Validation" | |
on: | |
pull_request: | |
branches: | |
- main | |
push: | |
branches: | |
- main | |
jobs: | |
# Run Gradle Wrapper Validation Action to verify the Wrapper's checksum | |
gradle-validation: | |
name: Gradle Wrapper | |
runs-on: [ self-hosted ] | |
steps: | |
# Checkout current repository | |
- name: Fetch Sources | |
uses: actions/checkout@v2 | |
# Validate Wrapper | |
- name: Gradle Wrapper Validation | |
uses: gradle/wrapper-validation-action@v1 |
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: Run Ktlint | |
run: ./gradlew ktlintStagingDebugCheck | |
- name: Run Unit Tests | |
run: ./gradlew testStagingDebugUnitTest |
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: Restore playstore.keystore.jks | |
run: echo $KEYSTORE_FILE | base64 -d > /your_path_to/playstore.keystore.jks |
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: Restore gradle.properties | |
run: | | |
mkdir -p ~/.gradle/ | |
echo "KEYSTORE_FILE=/your_path_to/playstore.keystore.jks" >> ~/.gradle/gradle.properties | |
echo "KEYSTORE_PASSWORD=${{ secrets.KEYSTORE_PASSWORD }}" >> ~/.gradle/gradle.properties | |
echo "SIGNING_KEY_ALIAS=${{ secrets.SIGNING_KEY_ALIAS }}" >> ~/.gradle/gradle.properties | |
echo "SIGNING_KEY_PASSWORD=${{ secrets.SIGNING_KEY_PASSWORD }}" >> ~/.gradle/gradle.properties | |
shell: bash |
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: Release | |
id: create_release | |
uses: actions/create-release@v1 | |
with: | |
release_name: Release v.${{ env.VERSION_NAME }} | |
draft: false | |
prerelease: false | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
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: Upload Reports | |
uses: actions/upload-artifact@v2 | |
with: | |
name: Test-Reports | |
path: app/build/reports | |
if: always() |
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: Fetch Sources | |
uses: actions/checkout@v2 | |
with: | |
# Number of commits to fetch. 0 indicates all history for all branches and tags. | |
fetch-depth: 0 | |
- name: Setup JDK | |
uses: actions/setup-java@v2 | |
with: | |
distribution: 'zulu' | |
java-version: '11' | |
- name: Setup Android SDK | |
uses: android-actions/setup-android@v2 |
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
signingConfigs { | |
create("release") { | |
storeFile = file(project.property("KEYSTORE_FILE").toString()) | |
storePassword = project.property("KEYSTORE_PASSWORD").toString() | |
keyAlias = project.property("SIGNING_KEY_ALIAS").toString() | |
keyPassword = project.property("SIGNING_KEY_PASSWORD").toString() | |
} | |
} |
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
# Workflow name | |
name: Release App | |
# When it will be triggered | |
on: | |
push: | |
branches: | |
- main | |
# Where it will run | |
jobs: | |
build: | |
runs-on: ubuntu-latest |
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: Upload Release APK | |
id: upload_release_asset | |
uses: actions/upload-release-asset@v1.0.1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: app/build/outputs/apk/release/app-release.apk | |
asset_name: signed-artifact.apk | |
asset_content_type: application/zip |
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: Generate App Version Name | |
run: echo "VERSION_NAME=$(git describe --tags | sed 's/\(.*\)-/\1./' | sed 's/\(.*\)-/\1+/')" >> $GITHUB_ENV | |
- name: Bump Version | |
uses: chkfung/android-version-actions@v1.1 | |
with: | |
gradlePath: app/build.gradle.kts | |
versionCode: ${{ github.run_number }} | |
versionName: ${{ env.VERSION_NAME }} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment