Skip to content

Commit

Permalink
Merge pull request #49 from nevissecurity/feature/NEVISACCESSAPP-6100-…
Browse files Browse the repository at this point in the history
…self-hosted-runner

NEVISACCESSAPP-6100: Updated GH workflows to use self hosted runner.
  • Loading branch information
viktor-gulyas authored Aug 3, 2024
2 parents 2957904 + 77c24e4 commit 5d7b27b
Show file tree
Hide file tree
Showing 25 changed files with 689 additions and 753 deletions.
30 changes: 30 additions & 0 deletions .github/actions/create-tag/action.yml
Original file line number Diff line number Diff line change
@@ -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
})
38 changes: 38 additions & 0 deletions .github/actions/get-versions/action.yml
Original file line number Diff line number Diff line change
@@ -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}}
16 changes: 16 additions & 0 deletions .github/actions/increment-build-number/action.yml
Original file line number Diff line number Diff line change
@@ -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 }}
26 changes: 26 additions & 0 deletions .github/actions/setup-android/action.yml
Original file line number Diff line number Diff line change
@@ -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 }}
14 changes: 14 additions & 0 deletions .github/actions/setup-flutter/action.yml
Original file line number Diff line number Diff line change
@@ -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 }}

17 changes: 17 additions & 0 deletions .github/actions/setup-ios/action.yml
Original file line number Diff line number Diff line change
@@ -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'
11 changes: 11 additions & 0 deletions .github/actions/setup-pub-credentials/action.yml
Original file line number Diff line number Diff line change
@@ -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 }}
45 changes: 2 additions & 43 deletions .github/actions/update-config/action.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
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/[email protected]
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"
31 changes: 31 additions & 0 deletions .github/actions/update-flutter-dependencies/action.yml
Original file line number Diff line number Diff line change
@@ -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
13 changes: 13 additions & 0 deletions .github/actions/validate-flutter/action.yml
Original file line number Diff line number Diff line change
@@ -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
Loading

0 comments on commit 5d7b27b

Please sign in to comment.