From 77c24e40da6a74a2ef9d10fb131ad6644eb26fad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Viktor=20Guly=C3=A1s?= Date: Fri, 2 Aug 2024 10:17:59 +0200 Subject: [PATCH] NEVISACCESSAPP-6100: Updated GH workflows to use self hosted runner. --- .github/actions/create-tag/action.yml | 30 +++ .github/actions/get-versions/action.yml | 38 ++++ .../actions/increment-build-number/action.yml | 16 ++ .github/actions/setup-android/action.yml | 26 +++ .github/actions/setup-flutter/action.yml | 14 ++ .github/actions/setup-ios/action.yml | 17 ++ .../actions/setup-pub-credentials/action.yml | 11 + .github/actions/update-config/action.yml | 45 +--- .../update-flutter-dependencies/action.yml | 31 +++ .github/actions/validate-flutter/action.yml | 13 ++ .github/workflows/build.yml | 130 ------------ .github/workflows/develop.yml | 198 +++++++++++++----- .github/workflows/develop_pr.yml | 43 ---- .github/workflows/main.yml | 186 +++++++++++----- .github/workflows/pr.yml | 110 ++++++++++ .github/workflows/publish_android.yml | 130 ------------ .github/workflows/publish_ios.yml | 131 ------------ .github/workflows/release.yml | 96 +++++++++ .github/workflows/release_pr.yml | 28 --- .github/workflows/tagging.yml | 43 ---- .github/workflows/validation.yml | 56 ----- .github/workflows/versioning.yml | 42 ---- README.md | 4 +- android/fastlane/Fastfile | 2 +- ios/fastlane/Fastfile | 2 +- 25 files changed, 689 insertions(+), 753 deletions(-) create mode 100644 .github/actions/create-tag/action.yml create mode 100644 .github/actions/get-versions/action.yml create mode 100644 .github/actions/increment-build-number/action.yml create mode 100644 .github/actions/setup-android/action.yml create mode 100644 .github/actions/setup-flutter/action.yml create mode 100644 .github/actions/setup-ios/action.yml create mode 100644 .github/actions/setup-pub-credentials/action.yml create mode 100644 .github/actions/update-flutter-dependencies/action.yml create mode 100644 .github/actions/validate-flutter/action.yml delete mode 100644 .github/workflows/build.yml delete mode 100644 .github/workflows/develop_pr.yml create mode 100644 .github/workflows/pr.yml delete mode 100644 .github/workflows/publish_android.yml delete mode 100644 .github/workflows/publish_ios.yml create mode 100644 .github/workflows/release.yml delete mode 100644 .github/workflows/release_pr.yml delete mode 100644 .github/workflows/tagging.yml delete mode 100644 .github/workflows/validation.yml delete mode 100644 .github/workflows/versioning.yml diff --git a/.github/actions/create-tag/action.yml b/.github/actions/create-tag/action.yml new file mode 100644 index 0000000..1336649 --- /dev/null +++ b/.github/actions/create-tag/action.yml @@ -0,0 +1,30 @@ +name: Create Tag +description: Creates a tag + +inputs: + app-version: + description: The current version of the Application + required: true + build-number: + description: The current build-number of the Application + required: true + build-category: + description: The category of the tag to be created + required: true + +runs: + using: composite + steps: + - name: Create Tag + uses: actions/github-script@v6 + env: + TAG_NAME: ${{ inputs.build-category }}/${{ inputs.app-version }}/${{ inputs.build-number }} + with: + github-token: ${{ env.GITHUB_TOKEN }} + script: | + await github.rest.git.createRef({ + owner: context.repo.owner, + repo: context.repo.repo, + ref: "refs/tags/" + process.env.TAG_NAME, + sha: context.sha + }) \ No newline at end of file diff --git a/.github/actions/get-versions/action.yml b/.github/actions/get-versions/action.yml new file mode 100644 index 0000000..aebf0d1 --- /dev/null +++ b/.github/actions/get-versions/action.yml @@ -0,0 +1,38 @@ +name: Get Version +description: Retrieves the App and SDK versions and the build number for the application + +outputs: + app-version: + description: The current version of the Application + value: ${{ steps.get_app_version_number.outputs.version }} + sdk-version: + description: The current version of the used SDK + value: ${{ steps.get_sdk_version_number.outputs.sdk-version }} + build-number: + description: The generated build number + value: ${{ steps.get_build_number.outputs.build_number }} + +runs: + using: composite + steps: + - name: Get App Version Number + id: get_app_version_number + shell: bash + run: | + VERSION=`cat pubspec.yaml | grep -o 'version:[^:].*' | cut -f2 -d":" | cut -f1 -d"+" | xargs` + echo "version=$(echo $VERSION)" >> $GITHUB_OUTPUT + echo Version number is $VERSION + + - name: Get SDK Version Number + id: get_sdk_version_number + shell: bash + run: | + SDK_VERSION=`cat pubspec.yaml | grep -o "nevis_mobile_authentication_sdk: '[^']*'" | cut -f2 -d"'" | xargs` + echo "sdk-version=$(echo $SDK_VERSION)" >> $GITHUB_OUTPUT + echo SDK Version number is "$SDK_VERSION" + + - name: Generate Build Number + id: get_build_number + uses: onyxmueller/build-tag-number@v1 + with: + token: ${{env.GITHUB_TOKEN}} diff --git a/.github/actions/increment-build-number/action.yml b/.github/actions/increment-build-number/action.yml new file mode 100644 index 0000000..c5ab6ba --- /dev/null +++ b/.github/actions/increment-build-number/action.yml @@ -0,0 +1,16 @@ +name: Increment build number +description: Increments the build number of the App + +inputs: + build-number: + description: The new build number of the application + required: true + +runs: + using: composite + steps: + - name: Increment Build Number + shell: bash + run: | + dart pub global activate cider + cider bump build --build=${{ inputs.build-number }} diff --git a/.github/actions/setup-android/action.yml b/.github/actions/setup-android/action.yml new file mode 100644 index 0000000..283fadc --- /dev/null +++ b/.github/actions/setup-android/action.yml @@ -0,0 +1,26 @@ +name: Setup Android Environment +description: Sets up the environment for Android + +runs: + using: composite + steps: + - name: Setup Java JDK + uses: actions/setup-java@v3 + with: + distribution: 'zulu' + java-version: ${{ env.JAVA_VERSION }} + + - name: Cache RubyGem Dependencies + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ env.RUBY_VERSION }} + bundler-cache: true + working-directory: 'android' + + - name: Decode Keystore + if: ${{ env.KEYSTORE_FILE != '' }} + uses: timheuer/base64-to-file@v1 + with: + fileName: 'keystore-example-app.jks' + fileDir: './android/etc' + encodedString: ${{ env.KEYSTORE_FILE }} \ No newline at end of file diff --git a/.github/actions/setup-flutter/action.yml b/.github/actions/setup-flutter/action.yml new file mode 100644 index 0000000..7e3d263 --- /dev/null +++ b/.github/actions/setup-flutter/action.yml @@ -0,0 +1,14 @@ +name: Setup Flutter +description: Sets up Flutter + +runs: + using: composite + steps: + - name: Setup Flutter + uses: subosito/flutter-action@v2 + with: + flutter-version: ${{ env.FLUTTER_VERSION }} + channel: 'stable' + cache: true + cache-key: ${{ runner.os }}-flutter-cache-${{ env.FLUTTER_VERSION }} + diff --git a/.github/actions/setup-ios/action.yml b/.github/actions/setup-ios/action.yml new file mode 100644 index 0000000..a3becb0 --- /dev/null +++ b/.github/actions/setup-ios/action.yml @@ -0,0 +1,17 @@ +name: Setup iOS Environment +description: Sets up the environment for iOS + +runs: + using: composite + steps: + - name: Setup Xcode + uses: maxim-lobanov/setup-xcode@v1 + with: + xcode-version: ${{ env.XCODE_VERSION }} + + - name: Cache RubyGem Dependencies + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ env.RUBY_VERSION }} + bundler-cache: true + working-directory: 'ios' diff --git a/.github/actions/setup-pub-credentials/action.yml b/.github/actions/setup-pub-credentials/action.yml new file mode 100644 index 0000000..96c26ec --- /dev/null +++ b/.github/actions/setup-pub-credentials/action.yml @@ -0,0 +1,11 @@ +name: Setup Pub Credentials +description: Sets up Pub Credentials + +runs: + using: composite + steps: + - name: Setup Pub Credentials + shell: bash + run: | + echo Setting up Pub credentials... + echo '${{ env.PRIVATE_REPOSITORY_API_KEY }}' | dart pub token add ${{ env.PRIVATE_DART_REPOSITORY }} diff --git a/.github/actions/update-config/action.yml b/.github/actions/update-config/action.yml index 4bf35e8..a567fe8 100644 --- a/.github/actions/update-config/action.yml +++ b/.github/actions/update-config/action.yml @@ -1,60 +1,19 @@ name: Update Config description: 'Updates the configuration' -inputs: - host-name: - description: 'The host name to update' - required: false - private-dart-repository: - description: 'The URL of the private Dart repository' - required: false - private-repository-api-key: - description: 'The API key used for access to the private Dart repository' - required: false - runs: using: composite steps: - name: Update Configuration (loginRequestURL) - if: ${{ inputs.host-name }} uses: jossef/action-set-json-field@v2.1 with: file: assets/config_authentication_cloud.json field: login.loginRequestURL - value: "https://${{ inputs.host-name }}.mauth.nevis.cloud/_app/auth/pwd" + value: "https://${{ env.HOST_NAME }}.mauth.nevis.cloud/_app/auth/pwd" - name: Update Configuration (hostname) - if: ${{ inputs.host-name }} uses: jossef/action-set-json-field@v2.1 with: file: assets/config_authentication_cloud.json field: sdk.hostname - value: "${{ inputs.host-name }}.mauth.nevis.cloud" - - # Get SDK version number - - name: Get Version Number - id: get_sdk_version_number - shell: bash - run: | - SDK_VERSION=`cat pubspec.yaml | grep -o "nevis_mobile_authentication_sdk: '[^']*'" | cut -f2 -d"'" | xargs` - echo "sdk-version=$(echo $SDK_VERSION)" >> $GITHUB_OUTPUT - echo SDK Version number is "$SDK_VERSION" - - - name: Update plugin dependency in the pubspec - if: ${{ inputs.private-dart-repository }} - uses: fjogeleit/yaml-update-action@main - with: - valueFile: "pubspec.yaml" - changes: | - { - "dependencies.nevis_mobile_authentication_sdk": "", - "dependencies.nevis_mobile_authentication_sdk.hosted": "${{ inputs.private-dart-repository }}", - "dependencies.nevis_mobile_authentication_sdk.version": "${{ steps.get_sdk_version_number.outputs.sdk-version }}" - } - commitChange: false - - - name: Add API key to access the private repository - if: ${{ inputs.private-dart-repository && inputs.private-repository-api-key }} - shell: bash - run: | - echo '${{ inputs.private-repository-api-key }}' | dart pub token add ${{ inputs.private-dart-repository }} + value: "${{ env.HOST_NAME }}.mauth.nevis.cloud" diff --git a/.github/actions/update-flutter-dependencies/action.yml b/.github/actions/update-flutter-dependencies/action.yml new file mode 100644 index 0000000..330203d --- /dev/null +++ b/.github/actions/update-flutter-dependencies/action.yml @@ -0,0 +1,31 @@ +name: Update Flutter Dependencies +description: Updates the Flutter dependencies + +inputs: + sdk-version: + description: The version of the used Mobile Authentication SDK + required: false + +runs: + using: composite + steps: + - name: Update Plugin Dependency In The Pubspec + if: ${{ env.BUILD_TYPE == 'SNAPSHOT' }} + uses: fjogeleit/yaml-update-action@main + with: + valueFile: "pubspec.yaml" + changes: | + { + "dependencies.nevis_mobile_authentication_sdk": "", + "dependencies.nevis_mobile_authentication_sdk.hosted": "${{ env.PRIVATE_DART_REPOSITORY }}", + "dependencies.nevis_mobile_authentication_sdk.version": "${{ inputs.sdk-version }}" + } + commitChange: false + + - name: Setup Pub Credentials + if: ${{ env.BUILD_TYPE == 'SNAPSHOT' }} + uses: ./.github/actions/setup-pub-credentials + + - name: Resolve Flutter Packages + shell: bash + run: flutter pub get \ No newline at end of file diff --git a/.github/actions/validate-flutter/action.yml b/.github/actions/validate-flutter/action.yml new file mode 100644 index 0000000..90d132b --- /dev/null +++ b/.github/actions/validate-flutter/action.yml @@ -0,0 +1,13 @@ +name: Validate Flutter +description: Validates Flutter code by running formatter and the analyzer + +runs: + using: composite + steps: + - name: Run Dart Format + shell: bash + run: dart format --set-exit-if-changed . + + - name: Run Flutter Analyzer + shell: bash + run: flutter analyze diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index 2e99b6e..0000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,130 +0,0 @@ -# A reusable workflow file for building the native apps based on the inputs. - -name: Build Example App - -on: - workflow_call: - inputs: - build-android: - description: "Tells whether Android app build is needed" - default: false - required: false - type: boolean - build-ios: - description: "Tells whether iOS app build is needed" - default: false - required: false - type: boolean - secrets: - GITHUB_USERNAME: - required: false - GITHUB_PERSONAL_ACCESS_TOKEN: - required: false - PRIVATE_DART_REPOSITORY: - required: false - PRIVATE_NATIVE_REPOSITORY: - required: false - PRIVATE_REPOSITORY_API_KEY: - required: false - -env: - FLUTTER_VERSION: '3.19.0' - XCODE_VERSION: '15.0.1' - JAVA_VERSION: '11' - RUBY_VERSION: '3.0' - PRIVATE_DART_REPOSITORY: ${{ secrets.PRIVATE_DART_REPOSITORY }} - PRIVATE_REPOSITORY_API_KEY: ${{ secrets.PRIVATE_REPOSITORY_API_KEY }} - -jobs: - build_app: - name: Build - runs-on: macos-13 - - steps: - # Checkout the repository under $GITHUB_WORKSPACE - - name: Checkout Project - uses: actions/checkout@v3 - - # Make sure the stable version of Flutter is available - - name: Setup Flutter - uses: subosito/flutter-action@v2 - with: - flutter-version: ${{ env.FLUTTER_VERSION }} - channel: 'stable' - cache: true - cache-key: ${{ runner.os }}-flutter-cache-${{ env.FLUTTER_VERSION }} - - # Update the private dependencies - - name: Update Configuration - if: ${{ env.PRIVATE_DART_REPOSITORY && env.PRIVATE_REPOSITORY_API_KEY }} - uses: './.github/actions/update-config' - with: - private-dart-repository: ${{ secrets.PRIVATE_DART_REPOSITORY }} - private-repository-api-key: ${{ secrets.PRIVATE_REPOSITORY_API_KEY }} - - # Resolve Flutter packages - - name: Resolve Flutter Packages - run: flutter pub get - - ################################# - # Build iOS Example (if needed) # - ################################# - - # Ensure correct Xcode version is installed. - - name: Setup Xcode - if: ${{ inputs.build-ios }} - uses: maxim-lobanov/setup-xcode@v1 - with: - xcode-version: ${{ env.XCODE_VERSION }} - - # Set Ruby version and Cache RubyGem dependencies - - name: Cache RubyGem Dependencies - if: ${{ inputs.build-ios }} - uses: ruby/setup-ruby@v1 - with: - ruby-version: ${{ env.RUBY_VERSION }} - bundler-cache: true - working-directory: 'ios' - - # Build the iOS app - - name: Build iOS App - if: ${{ inputs.build-ios }} - env: - PRIVATE_NATIVE_REPOSITORY: ${{ secrets.PRIVATE_NATIVE_REPOSITORY }} - uses: maierj/fastlane-action@v3.0.0 - with: - lane: 'pr' - subdirectory: 'ios' - - ##################################### - # Build Android Example (if needed) # - ##################################### - - # Ensure correct Java version is installed - - name: Setup Java JDK - if: ${{ inputs.build-android }} - uses: actions/setup-java@v3 - with: - distribution: 'zulu' - java-version: ${{ env.JAVA_VERSION }} - - # Set Ruby version and Cache RubyGem dependencies - - name: Cache RubyGem Dependencies - if: ${{ inputs.build-android }} - uses: ruby/setup-ruby@v1 - with: - ruby-version: ${{ env.RUBY_VERSION }} - bundler-cache: true - working-directory: 'android' - - # Build the Android app - - name: Build Android App - if: ${{ inputs.build-android }} - env: - PRIVATE_NATIVE_REPOSITORY: ${{ secrets.PRIVATE_NATIVE_REPOSITORY }} - GITHUB_USERNAME: ${{ secrets.GITHUB_USERNAME }} - GITHUB_PERSONAL_ACCESS_TOKEN: ${{ secrets.GITHUB_PERSONAL_ACCESS_TOKEN }} - uses: maierj/fastlane-action@v3.0.0 - with: - lane: 'pr' - subdirectory: 'android' diff --git a/.github/workflows/develop.yml b/.github/workflows/develop.yml index e058aa9..7e42539 100644 --- a/.github/workflows/develop.yml +++ b/.github/workflows/develop.yml @@ -4,62 +4,152 @@ on: push: branches: [ 'develop' ] workflow_dispatch: + inputs: + ios-runner-type: + type: choice + required: true + description: "Runner type" + default: "self-hosted" + options: + - "self-hosted" + - "macos-13" + +env: + BUILD_TYPE: 'SNAPSHOT' # Allowed values: 'SNAPSHOT', 'RELEASE', 'RELEASE_CANDIDATE' + FLUTTER_VERSION: '3.19.0' + XCODE_VERSION: '15.4' + JAVA_VERSION: '11' + RUBY_VERSION: '3.1' + HOST_NAME: ${{ secrets.HOST_NAME }} + PRIVATE_REPOSITORY_API_KEY: ${{ secrets.PRIVATE_REPOSITORY_API_KEY }} + PRIVATE_DART_REPOSITORY: ${{ secrets.PRIVATE_DART_REPOSITORY }} + PRIVATE_NATIVE_IOS_REPOSITORY: ${{ secrets.PRIVATE_NATIVE_IOS_REPOSITORY }} + PRIVATE_NATIVE_ANDROID_REPOSITORY: ${{ secrets.PRIVATE_NATIVE_ANDROID_REPOSITORY }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_USERNAME: ${{ secrets.GH_USERNAME }} + GITHUB_PERSONAL_ACCESS_TOKEN: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} + FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }} + FIREBASE_APP_ID_IOS: ${{ secrets.FIREBASE_APP_ID_IOS }} + FIREBASE_APP_ID_ANDROID: ${{ secrets.FIREBASE_APP_ID_ANDROID }} + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} + MATCH_GIT_AUTHORIZATION: ${{ secrets.MATCH_GIT_AUTHORIZATION }} + MATCH_GIT_URL: ${{ secrets.MATCH_GIT_URL }} + MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }} + DEVELOPER_PORTAL_TEAM_ID: ${{ secrets.DEVELOPER_PORTAL_TEAM_ID }} + CODE_SIGNING_IDENTITY: ${{ secrets.CODE_SIGNING_IDENTITY }} + PROVISIONING_PROFILE_SPECIFIER: ${{ secrets.PROVISIONING_PROFILE_SPECIFIER }} + TEMP_KEYCHAIN_NAME: ${{ secrets.TEMP_KEYCHAIN_NAME }} + SIGNING_CONFIGS: ${{ secrets.SIGNING_CONFIGS }} + KEYSTORE_FILE: ${{ secrets.KEYSTORE_FILE }} + CURRENT_BUILD_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} jobs: versioning: - name: Versioning - uses: ./.github/workflows/versioning.yml - - publish_ios: - name: iOS - needs: versioning - uses: ./.github/workflows/publish_ios.yml - with: - version: ${{ needs.versioning.outputs.version }} - build-number: ${{ needs.versioning.outputs.build }} - build-on: "develop" - secrets: - HOST_NAME: ${{ secrets.HOST_NAME }} - FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }} - FIREBASE_APP_ID_IOS: ${{ secrets.FIREBASE_APP_ID_IOS }} - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} - MATCH_GIT_AUTHORIZATION: ${{ secrets.MATCH_GIT_AUTHORIZATION }} - MATCH_GIT_URL: ${{ secrets.MATCH_GIT_URL }} - MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }} - DEVELOPER_PORTAL_TEAM_ID: ${{ secrets.DEVELOPER_PORTAL_TEAM_ID }} - CODE_SIGNING_IDENTITY: ${{ secrets.CODE_SIGNING_IDENTITY }} - PROVISIONING_PROFILE_SPECIFIER: ${{ secrets.PROVISIONING_PROFILE_SPECIFIER }} - TEMP_KEYCHAIN_NAME: ${{ secrets.TEMP_KEYCHAIN_NAME }} - PRIVATE_DART_REPOSITORY: ${{ secrets.PRIVATE_DART_REPOSITORY }} - PRIVATE_NATIVE_REPOSITORY: ${{ secrets.PRIVATE_NATIVE_IOS_REPOSITORY }} - PRIVATE_REPOSITORY_API_KEY: ${{ secrets.PRIVATE_REPOSITORY_API_KEY }} - - publish_android: - name: Android - needs: versioning - uses: ./.github/workflows/publish_android.yml - with: - version: ${{ needs.versioning.outputs.version }} - build-number: ${{ needs.versioning.outputs.build }} - build-on: "develop" - secrets: - HOST_NAME: ${{ secrets.HOST_NAME }} - KEYSTORE_FILE: ${{ secrets.KEYSTORE_FILE }} - SIGNING_CONFIGS: ${{ secrets.SIGNING_CONFIGS }} - GITHUB_USERNAME: ${{ secrets.GH_USERNAME }} - GITHUB_PERSONAL_ACCESS_TOKEN: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} - FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }} - FIREBASE_APP_ID_ANDROID: ${{ secrets.FIREBASE_APP_ID_ANDROID }} - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} - PRIVATE_DART_REPOSITORY: ${{ secrets.PRIVATE_DART_REPOSITORY }} - PRIVATE_NATIVE_REPOSITORY: ${{ secrets.PRIVATE_NATIVE_ANDROID_REPOSITORY }} - PRIVATE_REPOSITORY_API_KEY: ${{ secrets.PRIVATE_REPOSITORY_API_KEY }} + name: Fetch Versions + runs-on: ubuntu-latest + outputs: + sdk-version: ${{ steps.get-versions.outputs.sdk-version }} + app-version: ${{ steps.get-versions.outputs.app-version }} + build-number: ${{ steps.get-versions.outputs.build-number }} + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Fetch Versions + id: get-versions + uses: ./.github/actions/get-versions + + publish-ios: + name: Publishing iOS App + needs: [versioning] + runs-on: ${{ github.event.inputs.ios-runner-type || 'self-hosted' }} + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Update Configuration + uses: ./.github/actions/update-config + + - name: Setup Flutter + uses: ./.github/actions/setup-flutter + + - name: Increment Build Number + uses: ./.github/actions/increment-build-number + with: + build-number: ${{ needs.versioning.outputs.build-number }} + + - name: Update Flutter Dependencies + uses: ./.github/actions/update-flutter-dependencies + with: + sdk-version: ${{ needs.versioning.outputs.sdk-version }} + + - name: Setup iOS Environment + uses: ./.github/actions/setup-ios + + - name: Build And Distribute The iOS Example App + env: + PRIVATE_NATIVE_REPOSITORY: ${{ env.PRIVATE_NATIVE_IOS_REPOSITORY }} + uses: maierj/fastlane-action@v3.0.0 + with: + lane: 'develop' + subdirectory: 'ios' + options: | + { + "version": "${{ needs.versioning.outputs.app-version }}", + "build_number": "${{ needs.versioning.outputs.build-number }}" + } + + publish-android: + name: Publishing Android App + needs: [versioning] + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Update Configuration + uses: ./.github/actions/update-config + + - name: Setup Flutter + uses: ./.github/actions/setup-flutter + + - name: Increment Build Number + uses: ./.github/actions/increment-build-number + with: + build-number: ${{ needs.versioning.outputs.build-number }} + + - name: Update Flutter Dependencies + uses: ./.github/actions/update-flutter-dependencies + with: + sdk-version: ${{ needs.versioning.outputs.sdk-version }} + + - name: Setup Android Environment + uses: ./.github/actions/setup-android + + - name: Build And Distribute The Android Example App + env: + PRIVATE_NATIVE_REPOSITORY: ${{ env.PRIVATE_NATIVE_ANDROID_REPOSITORY }} + uses: maierj/fastlane-action@v3.0.0 + with: + lane: 'develop' + subdirectory: 'android' + options: | + { + "version": "${{ needs.versioning.outputs.app-version }}", + "build_number": "${{ needs.versioning.outputs.build-number }}" + } tag: - name: Tag - needs: [versioning, publish_ios, publish_android] - uses: ./.github/workflows/tagging.yml - with: - version: ${{ needs.versioning.outputs.version }} - build-number: ${{ needs.versioning.outputs.build }} - build-category: "build" + name: Tagging + needs: [versioning, publish-ios, publish-android] + runs-on: ubuntu-latest + steps: + - name: Checkout Project + uses: actions/checkout@v3 + + - name: Create Tag + uses: ./.github/actions/create-tag + with: + build-category: 'build' + app-version: ${{ needs.versioning.outputs.app-version }} + build-number: ${{ needs.versioning.outputs.build-number }} diff --git a/.github/workflows/develop_pr.yml b/.github/workflows/develop_pr.yml deleted file mode 100644 index 2eacd07..0000000 --- a/.github/workflows/develop_pr.yml +++ /dev/null @@ -1,43 +0,0 @@ -name: Verify Development Pull Request - -on: - pull_request: - branches: [ 'develop' ] - types: [opened, edited, synchronize, reopened] - -jobs: - versioning: - name: Versioning - uses: ./.github/workflows/versioning.yml - - validation: - name: Validate Flutter - needs: versioning - uses: ./.github/workflows/validation.yml - secrets: - PRIVATE_DART_REPOSITORY: ${{ secrets.PRIVATE_DART_REPOSITORY }} - PRIVATE_REPOSITORY_API_KEY: ${{ secrets.PRIVATE_REPOSITORY_API_KEY }} - - build_ios: - name: iOS - needs: [versioning, validation] - uses: ./.github/workflows/build.yml - with: - build-ios: true - secrets: - PRIVATE_DART_REPOSITORY: ${{ secrets.PRIVATE_DART_REPOSITORY }} - PRIVATE_NATIVE_REPOSITORY: ${{ secrets.PRIVATE_NATIVE_IOS_REPOSITORY }} - PRIVATE_REPOSITORY_API_KEY: ${{ secrets.PRIVATE_REPOSITORY_API_KEY }} - - build_android: - name: Android - needs: [versioning, validation] - uses: ./.github/workflows/build.yml - with: - build-android: true - secrets: - GITHUB_USERNAME: ${{ secrets.GH_USERNAME }} - GITHUB_PERSONAL_ACCESS_TOKEN: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} - PRIVATE_DART_REPOSITORY: ${{ secrets.PRIVATE_DART_REPOSITORY }} - PRIVATE_NATIVE_REPOSITORY: ${{ secrets.PRIVATE_NATIVE_ANDROID_REPOSITORY }} - PRIVATE_REPOSITORY_API_KEY: ${{ secrets.PRIVATE_REPOSITORY_API_KEY }} diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6dab084..1f93d8c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -7,58 +7,144 @@ on: # At 5:30 am on the 1st and 15th day of the month (every two weeks) - cron: '30 5 1,15 * *' workflow_dispatch: + inputs: + ios-runner-type: + type: choice + required: true + description: "Runner type" + default: "self-hosted" + options: + - "self-hosted" + - "macos-13" + +env: + BUILD_TYPE: 'RELEASE' # Allowed values: 'SNAPSHOT', 'RELEASE', 'RELEASE_CANDIDATE' + FLUTTER_VERSION: '3.19.0' + XCODE_VERSION: '15.4' + JAVA_VERSION: '11' + RUBY_VERSION: '3.1' + HOST_NAME: ${{ secrets.HOST_NAME }} + PRIVATE_REPOSITORY_API_KEY: ${{ secrets.PRIVATE_REPOSITORY_API_KEY }} + PRIVATE_DART_REPOSITORY: ${{ secrets.PRIVATE_DART_REPOSITORY }} + PRIVATE_NATIVE_IOS_REPOSITORY: ${{ secrets.PRIVATE_NATIVE_IOS_REPOSITORY }} + PRIVATE_NATIVE_ANDROID_REPOSITORY: ${{ secrets.PRIVATE_NATIVE_ANDROID_REPOSITORY }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_USERNAME: ${{ secrets.GH_USERNAME }} + GITHUB_PERSONAL_ACCESS_TOKEN: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} + FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }} + FIREBASE_APP_ID_IOS: ${{ secrets.FIREBASE_APP_ID_IOS }} + FIREBASE_APP_ID_ANDROID: ${{ secrets.FIREBASE_APP_ID_ANDROID }} + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} + MATCH_GIT_AUTHORIZATION: ${{ secrets.MATCH_GIT_AUTHORIZATION }} + MATCH_GIT_URL: ${{ secrets.MATCH_GIT_URL }} + MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }} + DEVELOPER_PORTAL_TEAM_ID: ${{ secrets.DEVELOPER_PORTAL_TEAM_ID }} + CODE_SIGNING_IDENTITY: ${{ secrets.CODE_SIGNING_IDENTITY }} + PROVISIONING_PROFILE_SPECIFIER: ${{ secrets.PROVISIONING_PROFILE_SPECIFIER }} + TEMP_KEYCHAIN_NAME: ${{ secrets.TEMP_KEYCHAIN_NAME }} + SIGNING_CONFIGS: ${{ secrets.SIGNING_CONFIGS }} + KEYSTORE_FILE: ${{ secrets.KEYSTORE_FILE }} + CURRENT_BUILD_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} jobs: versioning: - name: Versioning - uses: ./.github/workflows/versioning.yml - - publish_ios: - name: iOS - needs: versioning - uses: ./.github/workflows/publish_ios.yml - with: - version: ${{ needs.versioning.outputs.version }} - build-number: ${{ needs.versioning.outputs.build }} - build-on: "main" - secrets: - HOST_NAME: ${{ secrets.HOST_NAME }} - FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }} - FIREBASE_APP_ID_IOS: ${{ secrets.FIREBASE_APP_ID_IOS }} - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} - MATCH_GIT_AUTHORIZATION: ${{ secrets.MATCH_GIT_AUTHORIZATION }} - MATCH_GIT_URL: ${{ secrets.MATCH_GIT_URL }} - MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }} - DEVELOPER_PORTAL_TEAM_ID: ${{ secrets.DEVELOPER_PORTAL_TEAM_ID }} - CODE_SIGNING_IDENTITY: ${{ secrets.CODE_SIGNING_IDENTITY }} - PROVISIONING_PROFILE_SPECIFIER: ${{ secrets.PROVISIONING_PROFILE_SPECIFIER }} - TEMP_KEYCHAIN_NAME: ${{ secrets.TEMP_KEYCHAIN_NAME }} - PRIVATE_REPOSITORY_API_KEY: ${{ secrets.PRIVATE_REPOSITORY_API_KEY }} - - publish_android: - name: Android - needs: versioning - uses: ./.github/workflows/publish_android.yml - with: - version: ${{ needs.versioning.outputs.version }} - build-number: ${{ needs.versioning.outputs.build }} - build-on: "main" - secrets: - HOST_NAME: ${{ secrets.HOST_NAME }} - KEYSTORE_FILE: ${{ secrets.KEYSTORE_FILE }} - SIGNING_CONFIGS: ${{ secrets.SIGNING_CONFIGS }} - GITHUB_USERNAME: ${{ secrets.GH_USERNAME }} - GITHUB_PERSONAL_ACCESS_TOKEN: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} - FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }} - FIREBASE_APP_ID_ANDROID: ${{ secrets.FIREBASE_APP_ID_ANDROID }} - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} - PRIVATE_REPOSITORY_API_KEY: ${{ secrets.PRIVATE_REPOSITORY_API_KEY }} + name: Fetch Versions + runs-on: ubuntu-latest + outputs: + sdk-version: ${{ steps.get-versions.outputs.sdk-version }} + app-version: ${{ steps.get-versions.outputs.app-version }} + build-number: ${{ steps.get-versions.outputs.build-number }} + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Fetch Versions + id: get-versions + uses: ./.github/actions/get-versions + + publish-ios: + name: Publishing iOS App + needs: [versioning] + runs-on: ${{ github.event.inputs.ios-runner-type || 'self-hosted' }} + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Update Configuration + uses: ./.github/actions/update-config + + - name: Setup Flutter + uses: ./.github/actions/setup-flutter + + - name: Increment Build Number + uses: ./.github/actions/increment-build-number + with: + build-number: ${{ needs.versioning.outputs.build-number }} + + - name: Update Flutter Dependencies + uses: ./.github/actions/update-flutter-dependencies + + - name: Setup iOS Environment + uses: ./.github/actions/setup-ios + + - name: Build And Distribute The iOS Example App + uses: maierj/fastlane-action@v3.0.0 + with: + lane: 'main' + subdirectory: 'ios' + options: | + { + "version": "${{ needs.versioning.outputs.app-version }}", + "build_number": "${{ needs.versioning.outputs.build-number }}" + } + + publish-android: + name: Publishing Android App + needs: [versioning] + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Update Configuration + uses: ./.github/actions/update-config + + - name: Setup Flutter + uses: ./.github/actions/setup-flutter + + - name: Increment Build Number + uses: ./.github/actions/increment-build-number + with: + build-number: ${{ needs.versioning.outputs.build-number }} + + - name: Update Flutter Dependencies + uses: ./.github/actions/update-flutter-dependencies + + - name: Setup Android Environment + uses: ./.github/actions/setup-android + + - name: Build And Distribute The Android Example App + uses: maierj/fastlane-action@v3.0.0 + with: + lane: 'main' + subdirectory: 'android' + options: | + { + "version": "${{ needs.versioning.outputs.app-version }}", + "build_number": "${{ needs.versioning.outputs.build-number }}" + } tag: - name: Tag - needs: [versioning, publish_ios, publish_android] - uses: ./.github/workflows/tagging.yml - with: - version: ${{ needs.versioning.outputs.version }} - build-number: ${{ needs.versioning.outputs.build }} - build-category: "release" + name: Tagging + needs: [versioning, publish-ios, publish-android] + runs-on: ubuntu-latest + steps: + - name: Checkout Project + uses: actions/checkout@v3 + + - name: Create Tag + uses: ./.github/actions/create-tag + with: + build-category: 'release' + app-version: ${{ needs.versioning.outputs.app-version }} + build-number: ${{ needs.versioning.outputs.build-number }} diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml new file mode 100644 index 0000000..7c52ce6 --- /dev/null +++ b/.github/workflows/pr.yml @@ -0,0 +1,110 @@ +name: Pull Request + +on: + pull_request: + branches: [ 'develop' ] + workflow_dispatch: + inputs: + ios-runner-type: + type: choice + required: true + description: "Runner type" + default: "self-hosted" + options: + - "self-hosted" + - "macos-13" + +env: + BUILD_TYPE: 'SNAPSHOT' # Allowed values: 'SNAPSHOT', 'RELEASE', 'RELEASE_CANDIDATE' + FLUTTER_VERSION: '3.19.0' + XCODE_VERSION: '15.4' + JAVA_VERSION: '11' + RUBY_VERSION: '3.1' + HOST_NAME: ${{ secrets.HOST_NAME }} + PRIVATE_REPOSITORY_API_KEY: ${{ secrets.PRIVATE_REPOSITORY_API_KEY }} + PRIVATE_DART_REPOSITORY: ${{ secrets.PRIVATE_DART_REPOSITORY }} + PRIVATE_NATIVE_IOS_REPOSITORY: ${{ secrets.PRIVATE_NATIVE_IOS_REPOSITORY }} + PRIVATE_NATIVE_ANDROID_REPOSITORY: ${{ secrets.PRIVATE_NATIVE_ANDROID_REPOSITORY }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_USERNAME: ${{ secrets.GH_USERNAME }} + GITHUB_PERSONAL_ACCESS_TOKEN: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} + CURRENT_BUILD_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} + +jobs: + flutter-validation: + name: Validate Flutter + runs-on: ubuntu-latest + outputs: + sdk-version: ${{ steps.get-versions.outputs.sdk-version }} + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Fetch SDK Version + id: get-versions + uses: ./.github/actions/get-versions + + - name: Setup Flutter + uses: ./.github/actions/setup-flutter + + - name: Update Flutter dependencies + uses: ./.github/actions/update-flutter-dependencies + with: + sdk-version: ${{ steps.get-versions.outputs.sdk-version }} + + - name: Validate Flutter + uses: ./.github/actions/validate-flutter + + ios-build: + name: Building iOS App + runs-on: ${{ github.event.inputs.ios-runner-type || 'self-hosted' }} + needs: [flutter-validation] + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Flutter + uses: ./.github/actions/setup-flutter + + - name: Update Flutter Dependencies + uses: ./.github/actions/update-flutter-dependencies + with: + sdk-version: ${{ needs.flutter-validation.outputs.sdk-version }} + + - name: Setup iOS Environment + uses: ./.github/actions/setup-ios + + - name: Build iOS Example App + env: + PRIVATE_NATIVE_REPOSITORY: ${{ env.PRIVATE_NATIVE_IOS_REPOSITORY }} + uses: maierj/fastlane-action@v3.0.0 + with: + lane: 'pr' + subdirectory: 'ios' + + android-build: + name: Building Android App + runs-on: ubuntu-latest + needs: [flutter-validation] + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Flutter + uses: ./.github/actions/setup-flutter + + - name: Update Flutter Dependencies + uses: ./.github/actions/update-flutter-dependencies + with: + sdk-version: ${{ needs.flutter-validation.outputs.sdk-version }} + + - name: Setup Android Environment + uses: ./.github/actions/setup-android + + - name: Build Android Example App + env: + PRIVATE_NATIVE_REPOSITORY: ${{ env.PRIVATE_NATIVE_ANDROID_REPOSITORY }} + uses: maierj/fastlane-action@v3.0.0 + with: + lane: 'pr' + subdirectory: 'android' \ No newline at end of file diff --git a/.github/workflows/publish_android.yml b/.github/workflows/publish_android.yml deleted file mode 100644 index db81cf8..0000000 --- a/.github/workflows/publish_android.yml +++ /dev/null @@ -1,130 +0,0 @@ -# A reusable workflow file for publishing a Flutter package - -name: Publish Flutter Package - -on: - workflow_call: - inputs: - version: - description: "The current version number" - required: true - type: string - build-number: - description: "The current build number" - required: true - type: string - build-on: - description: "The branch the build is executed on, which determines the current build type" - required: true - type: string - secrets: - HOST_NAME: - required: true - KEYSTORE_FILE: - required: true - SIGNING_CONFIGS: - required: true - GITHUB_USERNAME: - required: true - GITHUB_PERSONAL_ACCESS_TOKEN: - required: true - FIREBASE_TOKEN: - required: true - FIREBASE_APP_ID_ANDROID: - required: true - SLACK_WEBHOOK_URL: - required: true - PRIVATE_DART_REPOSITORY: - required: false - PRIVATE_NATIVE_REPOSITORY: - required: false - PRIVATE_REPOSITORY_API_KEY: - required: true - -env: - FLUTTER_VERSION: '3.19.0' - JAVA_VERSION: '11' - RUBY_VERSION: '3.0' - CURRENT_BUILD_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} - -jobs: - publish: - name: Publish - runs-on: ubuntu-latest - - steps: - # Checkout the repository under $GITHUB_WORKSPACE - - name: Checkout Project - uses: actions/checkout@v3 - - # Make sure the stable version of Flutter is available - - name: Setup Flutter - uses: subosito/flutter-action@v2 - with: - flutter-version: ${{ env.FLUTTER_VERSION }} - channel: 'stable' - cache: true - cache-key: ${{ runner.os }}-flutter-cache-${{ env.FLUTTER_VERSION }} - - # Set Ruby version and Cache RubyGem dependencies - - name: Cache RubyGem Dependencies - uses: ruby/setup-ruby@v1 - with: - ruby-version: ${{ env.RUBY_VERSION }} - bundler-cache: true - working-directory: 'android' - - # Update the dependencies and the Auth Cloud configuration - - name: Update Configuration - uses: './.github/actions/update-config' - with: - host-name: ${{ secrets.HOST_NAME }} - private-dart-repository: ${{ secrets.PRIVATE_DART_REPOSITORY }} - private-repository-api-key: ${{ secrets.PRIVATE_REPOSITORY_API_KEY }} - version: ${{ inputs.version }} - - # Increment build number in the pubspec.yaml file - - name: Increment Build Number - run: | - dart pub global activate cider - cider bump build --build=${{ inputs.build-number }} - - # Resolve Flutter packages - - name: Resolve Flutter packages - run: flutter pub get - - # Ensure correct Java version is installed - - name: Setup Java JDK - uses: actions/setup-java@v3 - with: - distribution: 'zulu' - java-version: ${{ env.JAVA_VERSION }} - - # Move the Java keystore to its place - - name: Decode Keystore - uses: timheuer/base64-to-file@v1 - with: - fileName: 'keystore-example-app.jks' - fileDir: './android/etc' - encodedString: ${{ secrets.KEYSTORE_FILE }} - - # Distribute the Android app - - name: Run Fastlane - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SIGNING_CONFIGS: ${{ secrets.SIGNING_CONFIGS }} - GITHUB_USERNAME: ${{ secrets.SIGNING_CONFIGS }} - GITHUB_PERSONAL_ACCESS_TOKEN: ${{ secrets.GITHUB_PERSONAL_ACCESS_TOKEN }} - FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }} - FIREBASE_APP_ID_ANDROID: ${{ secrets.FIREBASE_APP_ID_ANDROID }} - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} - PRIVATE_NATIVE_REPOSITORY: ${{ secrets.PRIVATE_NATIVE_REPOSITORY }} - uses: maierj/fastlane-action@v3.0.0 - with: - lane: '${{ inputs.build-on }}' - subdirectory: 'android' - options: | - { - "version": "${{ inputs.version }}", - "build_number": "${{ inputs.build-number }}" - } diff --git a/.github/workflows/publish_ios.yml b/.github/workflows/publish_ios.yml deleted file mode 100644 index 491e032..0000000 --- a/.github/workflows/publish_ios.yml +++ /dev/null @@ -1,131 +0,0 @@ -# A reusable workflow file for publishing the iOS example app. - -name: Publish iOS App - -on: - workflow_call: - inputs: - version: - description: "The current version number" - required: true - type: string - build-number: - description: "The current build number" - required: true - type: string - build-on: - description: "The branch the build is executed on, which determines the current build type" - required: true - type: string - secrets: - HOST_NAME: - required: true - FIREBASE_TOKEN: - required: true - FIREBASE_APP_ID_IOS: - required: true - MATCH_GIT_AUTHORIZATION: - required: true - MATCH_GIT_URL: - required: true - MATCH_PASSWORD: - required: true - DEVELOPER_PORTAL_TEAM_ID: - required: true - CODE_SIGNING_IDENTITY: - required: true - PROVISIONING_PROFILE_SPECIFIER: - required: true - TEMP_KEYCHAIN_NAME: - required: true - SLACK_WEBHOOK_URL: - required: true - PRIVATE_DART_REPOSITORY: - required: false - PRIVATE_NATIVE_REPOSITORY: - required: false - PRIVATE_REPOSITORY_API_KEY: - required: true - -env: - FLUTTER_VERSION: '3.19.0' - XCODE_VERSION: '15.0.1' - RUBY_VERSION: '3.0' - CURRENT_BUILD_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} - -jobs: - publish: - name: Publish - runs-on: macos-13 - - steps: - # Checkout the repository under $GITHUB_WORKSPACE - - name: Checkout Project - uses: actions/checkout@v3 - - # Make sure the stable version of Flutter is available - - name: Setup Flutter - uses: subosito/flutter-action@v2 - with: - flutter-version: ${{ env.FLUTTER_VERSION }} - channel: 'stable' - cache: true - cache-key: ${{ runner.os }}-flutter-cache-${{ env.FLUTTER_VERSION }} - - # Set Ruby version and Cache RubyGem dependencies - - name: Cache RubyGem Dependencies - uses: ruby/setup-ruby@v1 - with: - ruby-version: ${{ env.RUBY_VERSION }} - bundler-cache: true - working-directory: 'ios' - - # Update the dependencies and the Auth Cloud configuration - - name: Update Configuration - uses: './.github/actions/update-config' - with: - host-name: ${{ secrets.HOST_NAME }} - private-dart-repository: ${{ secrets.PRIVATE_DART_REPOSITORY }} - private-repository-api-key: ${{ secrets.PRIVATE_REPOSITORY_API_KEY }} - version: ${{ inputs.version }} - - # Increment build number in the pubspec.yaml file - - name: Increment Build Number - run: | - dart pub global activate cider - cider bump build --build=${{ inputs.build-number }} - - # Resolve Flutter packages - - name: Resolve Flutter Packages - run: flutter pub get - - # Ensure correct Xcode version is installed - - name: Setup Xcode - uses: maxim-lobanov/setup-xcode@v1 - with: - xcode-version: ${{ env.XCODE_VERSION }} - - # Distribute the iOS app - - name: Run Fastlane - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - MATCH_GIT_AUTHORIZATION: ${{ secrets.MATCH_GIT_AUTHORIZATION }} - MATCH_GIT_URL: ${{ secrets.MATCH_GIT_URL }} - MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }} - DEVELOPER_PORTAL_TEAM_ID: ${{ secrets.DEVELOPER_PORTAL_TEAM_ID }} - CODE_SIGNING_IDENTITY: ${{ secrets.CODE_SIGNING_IDENTITY }} - PROVISIONING_PROFILE_SPECIFIER: ${{ secrets.PROVISIONING_PROFILE_SPECIFIER }} - FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }} - FIREBASE_APP_ID_IOS: ${{ secrets.FIREBASE_APP_ID_IOS }} - TEMP_KEYCHAIN_NAME: ${{ secrets.TEMP_KEYCHAIN_NAME }} - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} - PRIVATE_NATIVE_REPOSITORY: ${{ secrets.PRIVATE_NATIVE_REPOSITORY }} - uses: maierj/fastlane-action@v3.0.0 - with: - lane: '${{ inputs.build-on }}' - subdirectory: 'ios' - options: | - { - "version": "${{ inputs.version }}", - "build_number": "${{ inputs.build-number }}" - } diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..c5edd4a --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,96 @@ +name: Release Candidate Build + +on: + pull_request: + branches: [ 'main' ] + workflow_dispatch: + inputs: + ios-runner-type: + type: choice + required: true + description: "Runner type" + default: "self-hosted" + options: + - "self-hosted" + - "macos-13" + +env: + BUILD_TYPE: 'RELEASE_CANDIDATE' # Allowed values: 'SNAPSHOT', 'RELEASE', 'RELEASE_CANDIDATE' + FLUTTER_VERSION: '3.19.0' + XCODE_VERSION: '15.4' + JAVA_VERSION: '11' + RUBY_VERSION: '3.1' + HOST_NAME: ${{ secrets.HOST_NAME }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_USERNAME: ${{ secrets.GH_USERNAME }} + GITHUB_PERSONAL_ACCESS_TOKEN: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} + CURRENT_BUILD_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} + +jobs: + flutter-validation: + name: Validate Flutter + runs-on: ubuntu-latest + outputs: + sdk-version: ${{ steps.get-versions.outputs.sdk-version }} + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Fetch SDK Version + id: get-versions + uses: ./.github/actions/get-versions + + - name: Setup Flutter + uses: ./.github/actions/setup-flutter + + - name: Update Flutter Dependencies + uses: ./.github/actions/update-flutter-dependencies + + - name: Validate Flutter + uses: ./.github/actions/validate-flutter + + ios-build: + name: Building iOS App + runs-on: ${{ github.event.inputs.ios-runner-type || 'self-hosted' }} + needs: [flutter-validation] + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Flutter + uses: ./.github/actions/setup-flutter + + - name: Update Flutter Dependencies + uses: ./.github/actions/update-flutter-dependencies + + - name: Setup iOS Environment + uses: ./.github/actions/setup-ios + + - name: Build iOS Example App + uses: maierj/fastlane-action@v3.0.0 + with: + lane: 'pr' + subdirectory: 'ios' + + android-build: + name: Building Android App + runs-on: ubuntu-latest + needs: [flutter-validation] + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Flutter + uses: ./.github/actions/setup-flutter + + - name: Update Flutter Dependencies + uses: ./.github/actions/update-flutter-dependencies + + - name: Setup Android Environment + uses: ./.github/actions/setup-android + + - name: Build Android Example App + uses: maierj/fastlane-action@v3.0.0 + with: + lane: 'pr' + subdirectory: 'android' \ No newline at end of file diff --git a/.github/workflows/release_pr.yml b/.github/workflows/release_pr.yml deleted file mode 100644 index c12176c..0000000 --- a/.github/workflows/release_pr.yml +++ /dev/null @@ -1,28 +0,0 @@ -name: Verify Release Pull Request - -on: - pull_request: - branches: [ 'main', 'release/*' ] - types: [opened, edited, synchronize, reopened] - -jobs: - validation: - name: Flutter - uses: ./.github/workflows/validation.yml - - build_ios: - name: iOS - needs: validation - uses: ./.github/workflows/build.yml - with: - build-ios: true - - build_android: - name: Android - needs: validation - uses: ./.github/workflows/build.yml - with: - build-android: true - secrets: - GITHUB_USERNAME: ${{ secrets.GH_USERNAME }} - GITHUB_PERSONAL_ACCESS_TOKEN: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} diff --git a/.github/workflows/tagging.yml b/.github/workflows/tagging.yml deleted file mode 100644 index 8af4f11..0000000 --- a/.github/workflows/tagging.yml +++ /dev/null @@ -1,43 +0,0 @@ -# A reusable workflow file for tag creation. - -name: Tagging - -on: - workflow_call: - inputs: - version: - description: "The current version number" - required: true - type: string - build-number: - description: "The current build number" - required: true - type: string - build-category: - description: "The build category, which will be the 1st part of the tag name" - required: true - type: string - -jobs: - tag: - name: Create - runs-on: ubuntu-latest - - steps: - # Checkout the repository under $GITHUB_WORKSPACE - - name: Checkout Project - uses: actions/checkout@v3 - - - name: Create Tag - uses: actions/github-script@v6 - env: - TAG_NAME: ${{ inputs.build-category }}/${{ inputs.version }}/${{ inputs.build-number }} - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - script: | - await github.rest.git.createRef({ - owner: context.repo.owner, - repo: context.repo.repo, - ref: "refs/tags/" + process.env.TAG_NAME, - sha: context.sha - }) diff --git a/.github/workflows/validation.yml b/.github/workflows/validation.yml deleted file mode 100644 index ce7730c..0000000 --- a/.github/workflows/validation.yml +++ /dev/null @@ -1,56 +0,0 @@ -# A reusable workflow file for validating the Flutter code. -# Checks the format and analyzes the code. - -name: Validate App - -on: - workflow_call: - secrets: - PRIVATE_DART_REPOSITORY: - required: false - PRIVATE_REPOSITORY_API_KEY: - required: false - -env: - FLUTTER_VERSION: '3.19.0' - PRIVATE_DART_REPOSITORY: ${{ secrets.PRIVATE_DART_REPOSITORY }} - PRIVATE_REPOSITORY_API_KEY: ${{ secrets.PRIVATE_REPOSITORY_API_KEY }} - -jobs: - validation: - name: Validate - runs-on: ubuntu-latest - - steps: - # Checkout the repository under $GITHUB_WORKSPACE - - name: Checkout Project - uses: actions/checkout@v3 - - # Make sure the stable version of Flutter is available - - name: Setup Flutter - uses: subosito/flutter-action@v2 - with: - flutter-version: ${{ env.FLUTTER_VERSION }} - channel: 'stable' - cache: true - cache-key: ${{ runner.os }}-flutter-cache-${{ env.FLUTTER_VERSION }} - - # Update the private dependencies - - name: Update Configuration - if: ${{ env.PRIVATE_DART_REPOSITORY && env.PRIVATE_REPOSITORY_API_KEY }} - uses: './.github/actions/update-config' - with: - private-dart-repository: ${{ secrets.PRIVATE_DART_REPOSITORY }} - private-repository-api-key: ${{ secrets.PRIVATE_REPOSITORY_API_KEY }} - - # Resolve Flutter packages - - name: Resolve Flutter Packages - run: flutter pub get - - # Run Dart Format to ensure formatting is valid - - name: Run Dart Format - run: dart format --set-exit-if-changed . - - # Run Flutter Analyzer - - name: Run Flutter Analyzer - run: flutter analyze diff --git a/.github/workflows/versioning.yml b/.github/workflows/versioning.yml deleted file mode 100644 index 2aeb016..0000000 --- a/.github/workflows/versioning.yml +++ /dev/null @@ -1,42 +0,0 @@ -# A reusable workflow file for handling app versioning - -name: Versioning - -on: - workflow_call: - outputs: - version: - description: "The current version" - value: ${{ jobs.versioning.outputs.version }} - build: - description: "The generated build number" - value: ${{ jobs.versioning.outputs.build }} - -jobs: - versioning: - name: Get - runs-on: ubuntu-latest - - outputs: - version: ${{ steps.version_number.outputs.version }} - build: ${{ steps.build_number.outputs.build_number }} - - steps: - # Checkout the repository under $GITHUB_WORKSPACE - - name: Checkout Project - uses: actions/checkout@v3 - - # Get version number from the pubspec file - - name: Get Version Number - id: version_number - run: | - VERSION=`cat pubspec.yaml | grep -o 'version:[^:].*' | cut -f2 -d":" | cut -f1 -d"+" | xargs` - echo "version=$(echo $VERSION)" >> $GITHUB_OUTPUT - echo Version number is $VERSION - - # Generate build number - - name: Generate Build Number - id: build_number - uses: onyxmueller/build-tag-number@v1 - with: - token: ${{secrets.GITHUB_TOKEN}} diff --git a/README.md b/README.md index 12f106e..3f87fc1 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,10 @@ # Nevis Mobile Authentication SDK Flutter Example App +[![Pull Request](https://github.com/nevissecurity/nevis-mobile-authentication-sdk-example-app-flutter/actions/workflows/pr.yml/badge.svg)](https://github.com/nevissecurity/nevis-mobile-authentication-sdk-example-app-flutter/actions/workflows/pr.yml) +[![Develop Branch Commit](https://github.com/nevissecurity/nevis-mobile-authentication-sdk-example-app-flutter/actions/workflows/develop.yml/badge.svg)](https://github.com/nevissecurity/nevis-mobile-authentication-sdk-example-app-flutter/actions/workflows/develop.yml) +[![Release Candidate Build](https://github.com/nevissecurity/nevis-mobile-authentication-sdk-example-app-flutter/actions/workflows/release.yml/badge.svg)](https://github.com/nevissecurity/nevis-mobile-authentication-sdk-example-app-flutter/actions/workflows/release.yml) [![Main Branch Commit](https://github.com/nevissecurity/nevis-mobile-authentication-sdk-example-app-flutter/actions/workflows/main.yml/badge.svg)](https://github.com/nevissecurity/nevis-mobile-authentication-sdk-example-app-flutter/actions/workflows/main.yml) -[![Verify Pull Request](https://github.com/nevissecurity/nevis-mobile-authentication-sdk-example-app-flutter/actions/workflows/pr.yml/badge.svg)](https://github.com/nevissecurity/nevis-mobile-authentication-sdk-example-app-flutter/actions/workflows/pr.yml) This repository contains the example app demonstrating how to use the Nevis Mobile Authentication SDK Flutter plugin in a Flutter app. The Nevis Mobile Authentication SDK allows you to integrate passwordless authentication to your existing mobile app, backed by FIDO UAF 1.1. diff --git a/android/fastlane/Fastfile b/android/fastlane/Fastfile index 3b613a0..414ce20 100644 --- a/android/fastlane/Fastfile +++ b/android/fastlane/Fastfile @@ -78,7 +78,7 @@ platform :android do file_path: build_gradle, old_value: "url \"#{public_maven_repository}\"", new_value: "url \"#{private_maven_repository}\"", - ) + ) if private_maven_repository end desc "Build the application" diff --git a/ios/fastlane/Fastfile b/ios/fastlane/Fastfile index ebf27cd..fb70b22 100644 --- a/ios/fastlane/Fastfile +++ b/ios/fastlane/Fastfile @@ -106,7 +106,7 @@ platform :ios do desc "" private_lane :utilize_private_repos do private_pod_repository = ENV["PRIVATE_NATIVE_REPOSITORY"] - prepare_podfile(private_pod_repository) + prepare_podfile(private_pod_repository) if private_pod_repository end desc "Build the application"