diff --git a/.github/workflows/README.md b/.github/workflows/README.md index f863804..749de3f 100644 --- a/.github/workflows/README.md +++ b/.github/workflows/README.md @@ -1,12 +1,18 @@ -## Setting up workflows +## Setting Up Workflows -### 1. Following secrets are needed by implemented workflows. All of them are available -in organization level secrets, you just have to grant access to particular app: +Predefined workflows use shared configurations from the [Futured .github repository](https://github.com/futuredapp/.github). -1. `DANGER_GITHUB_API_TOKEN` -2. `SLACK_WEB_HOOK` -3. `APPCENTER_API_TOKEN` +### Adjusting Workflows +If you need modifications, such as adding new environment variables, consider the following approaches: + +1. **Suggest Improvements to Shared Workflows** + If the change could benefit multiple projects, propose an update to the shared workflows. + +2. **Customize for Your Project** + If the change is project-specific, copy the shared workflow into your repository and modify it accordingly. ### 2. Configure workflow .yml files For each workflow configuration file, configure all environment variables marked with `TODO` comment. + +For more details, visit the [Futured .github repository](https://github.com/futuredapp/.github) and [Futured Engineering Handbook](https://github.com/futuredapp/Engineering-Handbook). \ No newline at end of file diff --git a/.github/workflows/enterprise.yml b/.github/workflows/enterprise.yml index 206530f..e482231 100644 --- a/.github/workflows/enterprise.yml +++ b/.github/workflows/enterprise.yml @@ -1,53 +1,28 @@ name: Enterprise build + on: push: - branches: [develop] + branches: + - develop + +concurrency: + group: ${{ github.workflow }} + cancel-in-progress: true jobs: - enterprise: - name: Enterprise build - runs-on: [ubuntu-latest] - env: + deploy_enterprise: + name: Deploy enterprise build + uses: futuredapp/.github/.github/workflows/android-cloud-release-firebaseAppDistribution.yml@main + with: + TEST_GRADLE_TASKS: testDevEnterpriseUnitTest + BUNDLE_GRADLE_TASK: bundleDevEnterprise + UPLOAD_GRADLE_TASK: appDistributionUploadDevEnterprise + SIGNING_KEYSTORE_PATH: keystore/debug.jks # TODO Verify app distribution groups - APP_DISTRIBUTION_GROUPS: futured-qa, devs - APP_DISTRIBUTION_ARTIFACT_TYPE: APK - FIREBASE_CREDENTIALS_FILE: firebase_credentials.json - # TODO Platform-specific slack channel name for notifications, eg. "gmlh-android" - SLACK_CHANNEL: project-slack-channel-name - steps: - - uses: actions/checkout@v2 - - uses: ruby/setup-ruby@v1 - with: - ruby-version: '3.0' - - name: Set up JDK - uses: actions/setup-java@v2 - with: - distribution: 'zulu' - java-version: '17' - - name: Prepare environment - run: | - echo "BUILD_NUMBER=$((GITHUB_RUN_NUMBER))" >> $GITHUB_ENV - echo '${{ secrets.APP_DISTRIBUTION_SERVICE_ACCOUNT }}' > $FIREBASE_CREDENTIALS_FILE - - name: Run unit tests - shell: bash - run: ./gradlew --continue testDevEnterpriseUnitTest - - name: Assemble and upload to Firebase App Distribution - shell: bash - run: | - ./gradlew \ - assembleDevEnterprise \ - appDistributionUploadDevEnterprise \ - --serviceCredentialsFile="$FIREBASE_CREDENTIALS_FILE" \ - --artifactType="$APP_DISTRIBUTION_ARTIFACT_TYPE" \ - --groups="$APP_DISTRIBUTION_GROUPS" - - name: Slack Notification - if: failure() - uses: homoluctus/slatify@master - with: - type: "failure" - job_name: '*Enterprise build*' - username: GitHub - channel: ${{env.SLACK_CHANNEL}} - url: ${{secrets.SLACK_WEB_HOOK}} - commit: true - token: ${{secrets.GITHUB_TOKEN}} + APP_DISTRIBUTION_GROUPS: futured-devs, futured-qa + secrets: + # TODO Set up `APP_DISTRIBUTION_SERVICE_ACCOUNT` as plaintext JSON for this GitHub repository + SIGNING_KEYSTORE_PASSWORD: android + SIGNING_KEY_ALIAS: androiddebugkey + SIGNING_KEY_PASSWORD: android + APP_DISTRIBUTION_SERVICE_ACCOUNT: ${{ secrets.APP_DISTRIBUTION_SERVICE_ACCOUNT }} \ No newline at end of file diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 73e5cbc..5d94cb8 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -1,46 +1,14 @@ -name: Check PR -on: [pull_request] +name: Check Pull request + +on: [ pull_request ] + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref }} + cancel-in-progress: true jobs: - pr: - name: PR check - runs-on: [ubuntu-latest] - env: - # TODO Platform-specific slack channel name for notifications, eg. "gmlh-android" - SLACK_CHANNEL: project-slack-channel-name - steps: - - uses: actions/checkout@v2 - - uses: ruby/setup-ruby@v1 - with: - ruby-version: '3.0' - - name: Set up JDK - uses: actions/setup-java@v2 - with: - distribution: 'zulu' - java-version: '17' - - name: Run LintCheck - shell: bash - run: ./gradlew lintCheck - - name: Run unit tests - shell: bash - run: ./gradlew --continue testDevEnterpriseUnitTest - - name: Danger action - uses: MeilCli/danger-action@v2 - continue-on-error: true - with: - plugins_file: 'Gemfile' - danger_file: 'Dangerfile' - danger_id: 'danger-pr' - env: - DANGER_GITHUB_API_TOKEN: ${{ secrets.DANGER_GITHUB_API_TOKEN }} - - name: Slack Notification - if: failure() - uses: homoluctus/slatify@master - with: - type: "failure" - job_name: '*PR Check*' - username: GitHub - channel: ${{env.SLACK_CHANNEL}} - url: ${{ secrets.SLACK_WEB_HOOK }} - commit: true - token: ${{ secrets.GITHUB_TOKEN }} + check: + uses: futuredapp/.github/.github/workflows/android-cloud-check.yml@main + with: + LINT_GRADLE_TASKS: lintCheck + TEST_GRADLE_TASKS: testDevEnterpriseUnitTest diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c8fc4a0..64f560c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,69 +2,29 @@ name: Release build on: release: - types: [published] + types: [ published ] + +concurrency: + group: ${{ github.workflow }} + cancel-in-progress: true jobs: - release: - name: Release build - runs-on: [ubuntu-latest] - env: - EXCLUDE_AAB_FILTER: .*intermediate - # TODO Platform-specific slack channel name for notifications, eg. "gmlh-android" - SLACK_CHANNEL: project-slack-channel-name + deploy_release: + name: Deploy release build + uses: futuredapp/.github/.github/workflows/android-cloud-release-googlePlay.yml@main + with: VERSION_NAME: ${{ github.event.release.tag_name }} - steps: - - name: Set build number - run: echo "BUILD_NUMBER=$((GITHUB_RUN_NUMBER))" >> $GITHUB_ENV - - name: Checkout - uses: actions/checkout@v4 - - uses: ruby/setup-ruby@v1 - with: - ruby-version: '3.0' - - name: Setup Java - uses: actions/setup-java@v3 - with: - distribution: 'zulu' - java-version: '17' - - name: Run unit tests - shell: bash - run: ./gradlew --continue testDevEnterpriseUnitTest - - name: Generate app bundle - shell: bash - env: - # TODO Set up `RELEASE_KEYSTORE_PASSWORD` secret for this GitHub repository - # TODO Set up `RELEASE_KEY_PASSWORD` secret for this GitHub repository - # TODO Set up `RELEASE_KEY_ALIAS` secret for this GitHub repository - RELEASE_KEYSTORE_PASS: ${{ secrets.RELEASE_KEYSTORE_PASSWORD }} - RELEASE_KEY_PASS: ${{ secrets.RELEASE_KEY_PASSWORD }} - RELEASE_KEY_ALIAS: ${{ secrets.RELEASE_KEY_ALIAS }} - run: ./gradlew bundleProdRelease - - name: Find artifacts and mapping file - shell: bash - run: | - echo ::set-output name=aab_file::$(find . -name "*.aab" | grep -v ${{env.EXCLUDE_AAB_FILTER}}) - echo ::set-output name=mapping_file::$(find . -name mapping.txt) - id: artifacts - - name: Upload Android Release to Play Store - uses: r0adkll/upload-google-play@v1 - with: - # TODO Set up `GOOGLE_PLAY_PUBLISH_SERVICE_ACCOUNT` as plaintext JSON for this GitHub repository - serviceAccountJsonPlainText: ${{ secrets.GOOGLE_PLAY_PUBLISH_SERVICE_ACCOUNT }} - # TODO This has to be applicationId - packageName: app.futured.androidprojecttemplate - releaseFiles: ${{ steps.artifacts.outputs.aab_file }} - track: internal - status: draft - whatsNewDirectory: whatsnew - mappingFile: ${{ steps.artifacts.outputs.mapping_file }} - - name: Slack Notification - if: failure() - uses: homoluctus/slatify@master - with: - type: "failure" - job_name: '*Release build*' - username: GitHub - channel: ${{env.SLACK_CHANNEL}} - url: ${{secrets.SLACK_WEB_HOOK}} - commit: true - token: ${{secrets.GITHUB_TOKEN}} + BUNDLE_GRADLE_TASK: bundleProdRelease + SIGNING_KEYSTORE_PATH: keystore/release.jks + # TODO This has to be applicationId + GOOGLE_PLAY_APPLICATION_ID: app.futured.androidprojecttemplate + GOOGLE_PLAY_WHATSNEW_DIRECTORY: whatsnew + secrets: + # TODO Set up `RELEASE_KEYSTORE_PASSWORD` secret for this GitHub repository + # TODO Set up `RELEASE_KEY_PASSWORD` secret for this GitHub repository + # TODO Set up `RELEASE_KEY_ALIAS` secret for this GitHub repository + # TODO Set up `GOOGLE_PLAY_PUBLISH_SERVICE_ACCOUNT` as plaintext JSON for this GitHub repository + SIGNING_KEYSTORE_PASSWORD: ${{ secrets.RELEASE_KEYSTORE_PASSWORD }} + SIGNING_KEY_PASSWORD: ${{ secrets.RELEASE_KEY_PASSWORD }} + SIGNING_KEY_ALIAS: ${{ secrets.RELEASE_KEY_ALIAS }} + GOOGLE_PLAY_PUBLISH_SERVICE_ACCOUNT: ${{ secrets.GOOGLE_PLAY_PUBLISH_SERVICE_ACCOUNT }} diff --git a/README.md b/README.md index a925dfc..da8f5d1 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # ~~Project name~~ (Android) -![minSdk](https://img.shields.io/badge/minSdk-21-brightgreen.svg?style=flat) ![targetSdk](https://img.shields.io/badge/targetSdk-34-brightgreen.svg?style=flat) ![Bitrise](https://img.shields.io/bitrise/appid.svg?token=apptoken) +![minSdk](https://img.shields.io/badge/minSdk-29-brightgreen.svg?style=flat) ![targetSdk](https://img.shields.io/badge/targetSdk-34-brightgreen.svg?style=flat) ![Bitrise](https://img.shields.io/bitrise/appid.svg?token=apptoken) ~~Short project description.~~ diff --git a/buildSrc/src/main/kotlin/ProjectSettings.kt b/buildSrc/src/main/kotlin/ProjectSettings.kt index 06dfdb9..811b505 100644 --- a/buildSrc/src/main/kotlin/ProjectSettings.kt +++ b/buildSrc/src/main/kotlin/ProjectSettings.kt @@ -3,8 +3,8 @@ object ProjectSettings { const val compileSdkVersion = 34 const val targetSdk = 34 const val minSdk = 29 - val versionName = System.getenv("VERSION_NAME") ?: "1.0.0" - val versionCode = System.getenv("BUILD_NUMBER")?.toInt() ?: 1 + val versionName = System.getenv("ANDROID_VERSION_NAME") ?: "1.0.0" + val versionCode = System.getenv("ANDROID_BUILD_NUMBER")?.toInt() ?: 1 object Flavor { const val DIMENSION = "api" @@ -27,9 +27,9 @@ object ProjectSettings { } object Release { - const val KEY_ALIAS = "TBD" - val KEY_PASSWORD = System.getenv("KEY_PASSWORD") ?: "" - val STORE_PASSWORD = System.getenv("STORE_PASSWORD") ?: "" + val KEY_ALIAS = System.getenv("ANDROID_KEY_ALIAS") ?: "" + val KEY_PASSWORD = System.getenv("ANDROID_KEY_PASSWORD") ?: "" + val STORE_PASSWORD = System.getenv("ANDROID_KEYSTORE_PASSWORD") ?: "" } const val TASK_GROUP = "futured"