-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
NEVISACCESSAPP-5323: Add GitHub actions
- Loading branch information
1 parent
44409f2
commit b7454ed
Showing
35 changed files
with
1,535 additions
and
220 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# EditorConfig helps developers define and maintain consistent | ||
# coding styles between different editors and IDEs | ||
# editorconfig.org | ||
|
||
root = true | ||
|
||
[*] | ||
|
||
indent_style = tab | ||
indent_size = 4 | ||
|
||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,32 @@ | ||
name: Build Android | ||
description: Build Android example app | ||
Required environment variables | ||
* JAVA_VERSION | ||
* GITHUB_USERNAME | ||
* GITHUB_PERSONAL_ACCESS_TOKEN | ||
description: Build Android App | ||
|
||
inputs: | ||
build-4-new-arch: | ||
description: "If true, the artifact will be built for the new architecture." | ||
new-arch-enabled: | ||
description: "Flag that tells whether enable support to the new architecture." | ||
required: true | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Setup | ||
id: setup-node | ||
uses: ./.github/actions/setup | ||
uses: ./.github/actions/setup-node | ||
with: | ||
build-4-new-arch: ${{ inputs.build-4-new-arch }} | ||
new-arch-enabled: ${{ inputs.new-arch-enabled }} | ||
|
||
- name: Install JDK | ||
uses: actions/setup-java@v3 | ||
- name: Set up Android | ||
uses: ./.github/actions/setup-android | ||
with: | ||
distribution: 'zulu' | ||
java-version: ${{ env.JAVA_VERSION }} | ||
cache-gradle: ${{ steps.setup-node.outputs.cache-hit == 'true' }} | ||
|
||
- name: Finalize Android SDK | ||
- name: Build Android App | ||
shell: bash | ||
run: /bin/bash -c "yes | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --licenses > /dev/null" | ||
run: | | ||
if [[ ${{ inputs.new-arch-enabled }} == 'true' ]]; then | ||
NEW_ARCH_ENABLED=true | ||
else | ||
NEW_ARCH_ENABLED=false | ||
fi | ||
- name: Cache Gradle | ||
if: steps.setup-node.outputs.cache-hit == 'true' | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.gradle/wrapper | ||
~/.gradle/caches | ||
key: ${{ runner.os }}-gradle-${{ hashFiles('android/gradle/wrapper/gradle-wrapper.properties') }}-${{ inputs.build-4-new-arch == 'true' && 'new-arch' || 'old-arch' }}-${{ env.BUILD_TYPE }} | ||
|
||
- name: Build example for Android | ||
shell: bash | ||
run: yarn android:build | ||
|
||
- name: Slack report | ||
if: ${{ github.ref == 'refs/heads/main' }} | ||
uses: ./.github/actions/slack-report | ||
with: | ||
platform: 'iOS' | ||
is-workflow-state-success: success() | ||
yarn react-native build-android --mode Debug --extra-params -PnewArchEnabled=$NEW_ARCH_ENABLED |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,26 @@ | ||
name: Build iOS | ||
description: Build iOS example app | ||
Required environment variables | ||
* XCODE_VERSION | ||
description: Build iOS App | ||
|
||
inputs: | ||
build-4-new-arch: | ||
description: "If true, the artifact will be built for the new architecture." | ||
new-arch-enabled: | ||
description: "Flag that tells whether enable support to the new architecture." | ||
required: true | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Set Xcode version | ||
uses: maxim-lobanov/setup-xcode@v1 | ||
with: | ||
xcode-version: ${{ env.XCODE_VERSION }} | ||
|
||
- name: Setup | ||
- name: Set up Node | ||
id: setup-node | ||
uses: ./.github/actions/setup | ||
uses: ./.github/actions/setup-node | ||
with: | ||
build-4-new-arch: ${{ inputs.build-4-new-arch }} | ||
new-arch-enabled: ${{ inputs.new-arch-enabled }} | ||
|
||
- name: Cache cocoapods | ||
if: steps.setup-node.outputs.cache-hit == 'true' | ||
id: cocoapods-cache | ||
uses: actions/cache@v3 | ||
- name: Set up iOS | ||
uses: ./.github/actions/setup-ios | ||
with: | ||
path: | | ||
**/ios/Pods | ||
**/ios/build/generated | ||
key: ${{ runner.os }}-cocoapods-${{ hashFiles('ios/Podfile.lock') }}-${{ inputs.build-4-new-arch == 'true' && 'new-arch' || 'old-arch' }}-${{ env.BUILD_TYPE }} | ||
|
||
- name: Install cocoapods - new architecture | ||
shell: bash | ||
if: steps.cocoapods-cache.outputs.cache-hit != 'true' && inputs.build-4-new-arch == 'true' | ||
run: yarn pods:new | ||
new-arch-enabled: ${{ inputs.new-arch-enabled }} | ||
cache-cocoapods: ${{ steps.setup-node.outputs.cache-hit == 'true' }} | ||
|
||
- name: Install cocoapods - old architecture | ||
- name: Build iOS App | ||
shell: bash | ||
if: steps.cocoapods-cache.outputs.cache-hit != 'true' && inputs.build-4-new-arch == 'false' | ||
run: yarn pods:old | ||
|
||
- name: Build example for iOS | ||
shell: bash | ||
run: yarn ios:build | ||
|
||
- name: Slack report | ||
if: ${{ github.ref == 'refs/heads/main' }} | ||
uses: ./.github/actions/slack-report | ||
with: | ||
platform: 'iOS' | ||
is-workflow-state-success: success() | ||
run: yarn react-native build-ios --mode Debug |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,28 @@ | ||
name: Get Version | ||
description: Retrieves the version and build number of the app | ||
|
||
outputs: | ||
version-number: | ||
description: "The current version" | ||
value: ${{ steps.get_version_number.outputs.version_number }} | ||
build-number: | ||
description: "The generated build number" | ||
value: ${{ steps.get_build_number.outputs.build_number }} | ||
|
||
runs: | ||
using: composite | ||
|
||
steps: | ||
- name: Get version number | ||
id: get_version_number | ||
shell: bash | ||
run: | | ||
VERSION=$(cat ./package.json | jq '.version') | ||
echo "VERSION_NUMBER=${VERSION}" >> $GITHUB_ENV | ||
VERSION=$(cat ./package.json | jq -r '.version') | ||
echo "version_number=$(echo $VERSION)" >> $GITHUB_OUTPUT | ||
echo Version number is $VERSION | ||
- name: Generate Build Number | ||
id: build_number | ||
id: get_build_number | ||
uses: onyxmueller/build-tag-number@v1 | ||
with: | ||
token: ${{env.GITHUB_TOKEN}} | ||
token: ${{ env.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,37 @@ | ||
name: Create Git Tag | ||
description: Creates a git tag for the current repository | ||
Required environment variables | ||
* BUILD_NUMBER | ||
* VERSION_NUMBER | ||
* GITHUB_TOKEN | ||
|
||
inputs: | ||
version-number: | ||
description: "The current version number" | ||
required: false | ||
build-number: | ||
description: "The current build number" | ||
required: false | ||
|
||
runs: | ||
using: composite | ||
|
||
steps: | ||
- name: Create Tag | ||
uses: actions/github-script@v6 | ||
env: | ||
TAG_NAME: release/${{ env.VERSION_NUMBER }}/${{ env.BUILD_NUMBER }} | ||
TAG_NAME: release/${{ inputs.version-number }}/${{ inputs.build-number }} | ||
TAG_MESSAGE: "Release NMA SDK Example App React ${{ inputs.version-number }}/${{ inputs.build-number }}" | ||
with: | ||
github-token: ${{ env.GITHUB_TOKEN }} | ||
script: | | ||
const createdTag = await github.rest.git.createTag({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
tag: process.env.TAG_NAME, | ||
message: process.env.TAG_NAME, | ||
object: context.sha, | ||
type: "commit" | ||
}) | ||
await github.rest.git.createRef({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
ref: "refs/tags/" + process.env.TAG_NAME, | ||
sha: context.sha | ||
sha: createdTag.data.sha | ||
}) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
name: Release Android | ||
description: Release Android App | ||
|
||
inputs: | ||
new-arch-enabled: | ||
description: "Flag that tells whether enable support to the new architecture." | ||
required: true | ||
version-number: | ||
description: "The current version number" | ||
required: true | ||
build-number: | ||
description: "The current build number" | ||
required: true | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Setup | ||
id: setup-node | ||
uses: ./.github/actions/setup-node | ||
with: | ||
new-arch-enabled: ${{ inputs.new-arch-enabled }} | ||
|
||
- name: Set up Android | ||
uses: ./.github/actions/setup-android | ||
with: | ||
cache-gradle: ${{ steps.setup-node.outputs.cache-hit == 'true' }} | ||
|
||
- name: Update Configuration | ||
uses: ./.github/actions/update-config | ||
with: | ||
host-name: ${{ env.HOST_NAME }} | ||
|
||
- name: Bundle Android Assets | ||
shell: bash | ||
run: yarn react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res | ||
|
||
- name: Cache RubyGem Dependencies | ||
uses: ruby/setup-ruby@v1 | ||
with: | ||
ruby-version: ${{ env.RUBY_VERSION }} | ||
bundler-cache: true | ||
working-directory: 'android' | ||
|
||
- name: Decode Keystore | ||
uses: timheuer/base64-to-file@v1 | ||
with: | ||
fileName: 'keystore-example-app.jks' | ||
fileDir: './android/etc' | ||
encodedString: ${{ env.KEYSTORE_FILE }} | ||
|
||
- name: Publish Android App | ||
if: ${{ env.BUILD_TYPE == 'RELEASE' }} | ||
env: | ||
GITHUB_TOKEN: ${{ env.GITHUB_TOKEN }} | ||
SIGNING_CONFIGS: ${{ env.SIGNING_CONFIGS }} | ||
GITHUB_USERNAME: ${{ env.GITHUB_USERNAME }} | ||
GITHUB_PERSONAL_ACCESS_TOKEN: ${{ env.GITHUB_PERSONAL_ACCESS_TOKEN }} | ||
FIREBASE_TOKEN: ${{ env.FIREBASE_TOKEN }} | ||
FIREBASE_APP_ID_ANDROID: ${{ env.FIREBASE_APP_ID_ANDROID }} | ||
SLACK_WEBHOOK_URL: ${{ env.SLACK_WEBHOOK_URL }} | ||
uses: maierj/[email protected] | ||
with: | ||
lane: 'main' | ||
subdirectory: 'android' | ||
options: '{ "version": "${{ inputs.version-number }}", | ||
"build_number": "${{ inputs.build-number }}", | ||
"new_arch_enabled": "${{ inputs.new-arch-enabled }}" | ||
}' |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
name: Release iOS | ||
description: Release iOS App | ||
|
||
inputs: | ||
new-arch-enabled: | ||
description: "Flag that tells whether enable support to the new architecture." | ||
required: true | ||
version-number: | ||
description: "The current version number" | ||
required: true | ||
build-number: | ||
description: "The current build number" | ||
required: true | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Set up Node | ||
id: setup-node | ||
uses: ./.github/actions/setup-node | ||
with: | ||
new-arch-enabled: ${{ inputs.new-arch-enabled }} | ||
|
||
- name: Set up iOS | ||
uses: ./.github/actions/setup-ios | ||
with: | ||
new-arch-enabled: ${{ inputs.new-arch-enabled }} | ||
cache-cocoapods: ${{ steps.setup-node.outputs.cache-hit == 'true' }} | ||
|
||
- name: Update Configuration | ||
uses: ./.github/actions/update-config | ||
with: | ||
host-name: ${{ env.HOST_NAME }} | ||
|
||
- name: Cache RubyGem Dependencies | ||
uses: ruby/setup-ruby@v1 | ||
with: | ||
ruby-version: ${{ env.RUBY_VERSION }} | ||
bundler-cache: true | ||
working-directory: 'ios' | ||
|
||
- name: Publish iOS App | ||
env: | ||
MATCH_GIT_AUTHORIZATION: ${{ env.MATCH_GIT_AUTHORIZATION }} | ||
MATCH_GIT_URL: ${{ env.MATCH_GIT_URL }} | ||
MATCH_PASSWORD: ${{ env.MATCH_PASSWORD }} | ||
DEVELOPER_PORTAL_TEAM_ID: ${{ env.DEVELOPER_PORTAL_TEAM_ID }} | ||
CODE_SIGNING_IDENTITY: ${{ env.CODE_SIGNING_IDENTITY }} | ||
PROVISIONING_PROFILE_SPECIFIER: ${{ env.PROVISIONING_PROFILE_SPECIFIER }} | ||
FIREBASE_TOKEN: ${{ env.FIREBASE_TOKEN }} | ||
FIREBASE_APP_ID_IOS: ${{ env.FIREBASE_APP_ID_IOS }} | ||
TEMP_KEYCHAIN_NAME: ${{ env.TEMP_KEYCHAIN_NAME }} | ||
SLACK_WEBHOOK_URL: ${{ env.SLACK_WEBHOOK_URL }} | ||
uses: maierj/[email protected] | ||
with: | ||
lane: 'main' | ||
subdirectory: 'ios' | ||
options: '{ "version": "${{ inputs.version-number }}", | ||
"build_number": "${{ inputs.build-number }}" | ||
}' |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: Setup Android | ||
description: Setup Android resources and install dependencies | ||
|
||
inputs: | ||
cache-gradle: | ||
description: "Flag that tells whether need to cache Gradle dependencies." | ||
required: true | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Install JDK | ||
uses: actions/setup-java@v3 | ||
with: | ||
distribution: 'zulu' | ||
java-version: ${{ env.JAVA_VERSION }} | ||
|
||
- name: Finalize Android SDK | ||
shell: bash | ||
run: /bin/bash -c "yes | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --licenses > /dev/null" | ||
|
||
- name: Cache Gradle | ||
if: ${{ inputs.cache-gradle == 'true' }} | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.gradle/wrapper | ||
~/.gradle/caches | ||
key: ${{ runner.os }}-gradle-${{ hashFiles('android/gradle/wrapper/gradle-wrapper.properties') }}-${{ inputs.new-arch-enabled == 'true' && 'new-arch' || 'old-arch' }}-${{ env.BUILD_TYPE }} |
Oops, something went wrong.