Merge branch 'master' into cybertron-integration
This commit is contained in:
155
.github/workflows/codepushTele.yml
vendored
Normal file
155
.github/workflows/codepushTele.yml
vendored
Normal file
@@ -0,0 +1,155 @@
|
||||
name: code-push-cli-tele
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
environment:
|
||||
description: Choose build environment
|
||||
required: true
|
||||
type: choice
|
||||
options:
|
||||
- QA
|
||||
- Prod
|
||||
target_versions:
|
||||
description: please enter target versions
|
||||
required: true
|
||||
type: string
|
||||
default: '2.3.4'
|
||||
description:
|
||||
description: Enter please add change log
|
||||
required: true
|
||||
type: string
|
||||
default: 'login sso'
|
||||
jobs:
|
||||
generate:
|
||||
runs-on: [default]
|
||||
outputs:
|
||||
package_version: ${{ steps.get_version.outputs.version }}
|
||||
build_number: ${{ steps.get_version.outputs.buildNumber }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
token: ${{ secrets.MY_REPO_PAT }}
|
||||
submodules: recursive
|
||||
- name: Set Node.js 16.x
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 16.x
|
||||
- name: Get version from package.json
|
||||
id: get_version
|
||||
run: |
|
||||
VERSION=$(node -p "require('./package.json').version")
|
||||
BUILD_NUMBER=$(node -p "require('./package.json').buildNumber")
|
||||
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
||||
echo "Extracted version is $VERSION"
|
||||
echo "Set version to $VERSION"
|
||||
echo "buildNumber=$BUILD_NUMBER" >> $GITHUB_OUTPUT
|
||||
echo "Set buildNumber to $BUILD_NUMBER"
|
||||
- name: Install yarn
|
||||
run: npm install --global yarn
|
||||
- name: Install appcenter cli
|
||||
run: npm install -g appcenter-cli
|
||||
- name: Install dependency
|
||||
run: yarn
|
||||
- name: AppCenter login
|
||||
run: appcenter login --token ${{ secrets.APP_CENTER_LOGIN_TOKEN }}
|
||||
- name: CodePush QA
|
||||
if: ((github.event.inputs.environment == 'QA' || inputs.environment == 'QA'))
|
||||
run: yarn move:qa && appcenter codepush release-react -a varnit.goyal-navi.com/cosmos-tele-app-prod -d Staging -t "${{github.event.inputs.target_versions}}" --description "${{github.event.inputs.description}}"
|
||||
- name: CodePush Prod
|
||||
if: ((github.event.inputs.environment == 'Prod' || inputs.environment == 'Prod'))
|
||||
run: yarn move:prod && appcenter codepush release-react -a varnit.goyal-navi.com/cosmos-tele-app-prod -d Production -t "${{github.event.inputs.target_versions}}" --description "${{github.event.inputs.description}}"
|
||||
|
||||
generate_source_map:
|
||||
needs: generate
|
||||
runs-on: [default]
|
||||
if: success() && (github.event.inputs.environment == 'Prod') # Only create source map for Prod releases
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
token: ${{ secrets.MY_REPO_PAT }}
|
||||
submodules: recursive
|
||||
- name: Set Node.js 16.x
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 16.x
|
||||
- name: Install yarn
|
||||
run: npm install --global yarn
|
||||
- name: Install dependency
|
||||
run: yarn
|
||||
- name: Generate Android Bundle and Source Map
|
||||
run: |
|
||||
npx react-native bundle \
|
||||
--dev false \
|
||||
--minify true \
|
||||
--platform android \
|
||||
--entry-file index.js \
|
||||
--reset-cache \
|
||||
--bundle-output index.android.bundle \
|
||||
--sourcemap-output index.android.bundle.map
|
||||
|
||||
- name: Upload Source Map
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: source-map
|
||||
path: index.android.bundle.map
|
||||
|
||||
create_release_tag:
|
||||
needs: generate_source_map
|
||||
runs-on: [default]
|
||||
if: success() && (github.event.inputs.environment == 'Prod') # Only create tag for Prod releases
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
token: ${{ secrets.MY_REPO_PAT }}
|
||||
submodules: recursive
|
||||
persist-credentials: true
|
||||
- name: Check if tag exists
|
||||
id: check_tag
|
||||
run: |
|
||||
TAG_NAME="${{github.event.inputs.version_name || inputs.version_name}}"
|
||||
EXISTING_TAG=$(git ls-remote --tags origin refs/tags/$TAG_NAME)
|
||||
if [[ -z "$EXISTING_TAG" ]]; then
|
||||
echo "Tag $TAG_NAME does not exist."
|
||||
echo "tag_exists=false" >> $GITHUB_ENV
|
||||
else
|
||||
echo "Tag $TAG_NAME already exists."
|
||||
echo "tag_exists=true" >> $GITHUB_ENV
|
||||
fi
|
||||
|
||||
- name: Create and push tag
|
||||
if: env.tag_exists == 'false'
|
||||
run: |
|
||||
TAG_NAME="${{github.event.inputs.version_name || inputs.version_name}}"
|
||||
# git config --local user.email "${{ github.actor }}@github.com"
|
||||
git config --local user.name "${{ github.actor }}"
|
||||
git tag $TAG_NAME
|
||||
git push origin $TAG_NAME --no-verify
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.MY_REPO_PAT }}
|
||||
- name: Create release tag
|
||||
run: |
|
||||
TAG_NAME="${{github.event.inputs.version_name || inputs.version_name}}"
|
||||
BUILD_NUMBER="${{ needs.generate.outputs.build_number }}"
|
||||
RELEASE_NAME="$TAG_NAME (build $BUILD_NUMBER) code push"
|
||||
DESCRIPTION="${{ github.event.inputs.description }}"
|
||||
REPO="navi-medici/address-verification-app"
|
||||
BRANCH_NAME="${GITHUB_REF#refs/heads/}"
|
||||
|
||||
curl -X POST \
|
||||
-H "Authorization: token ${{ secrets.MY_REPO_PAT }}" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{
|
||||
\"tag_name\": \"$TAG_NAME\",
|
||||
\"target_commitish\": \"$BRANCH_NAME\",
|
||||
\"name\": \"$RELEASE_NAME\",
|
||||
\"body\": \"\",
|
||||
\"draft\": false,
|
||||
\"prerelease\": false,
|
||||
\"generate_release_notes\": true
|
||||
}" \
|
||||
"https://api.github.com/repos/$REPO/releases"
|
||||
shell: bash
|
||||
271
.github/workflows/hardReleaseTele.yml
vendored
Normal file
271
.github/workflows/hardReleaseTele.yml
vendored
Normal file
@@ -0,0 +1,271 @@
|
||||
name: generate-apk-tele
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
environment:
|
||||
description: Choose build environment
|
||||
required: true
|
||||
type: choice
|
||||
options:
|
||||
- QA
|
||||
- Prod
|
||||
releaseType:
|
||||
description: Choose release type
|
||||
required: true
|
||||
type: choice
|
||||
options:
|
||||
- TEST_BUILD
|
||||
- SOFT_RELEASE
|
||||
- HARD_RELEASE
|
||||
type:
|
||||
description: Choose build type
|
||||
required: true
|
||||
type: choice
|
||||
options:
|
||||
- release
|
||||
version_code:
|
||||
description: Enter app version code (example, 292)
|
||||
required: true
|
||||
type: string
|
||||
default: "292"
|
||||
version_name:
|
||||
description: Enter app version name (example, 3.2.1)
|
||||
required: true
|
||||
type: string
|
||||
default: "3.2.1"
|
||||
jobs:
|
||||
generate:
|
||||
runs-on: [ default ]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
token: ${{ secrets.MY_REPO_PAT }}
|
||||
submodules: recursive
|
||||
- name: update codepush key QA
|
||||
if: (github.event.inputs.environment == 'QA' || inputs.environment == 'QA')
|
||||
run: sed -i "s/pastekeyhere/${{ secrets.CODEPUSH_QA_KEY }}/" android/app/src/main/res/values/strings.xml && cat android/app/src/main/res/values/strings.xml
|
||||
- name: update codepush key PROD
|
||||
if: (github.event.inputs.environment == 'Prod' || inputs.environment == 'Prod')
|
||||
run: sed -i "s/pastekeyhere/${{ secrets.TELE_CODE_PUSH_PROD_KEY }}/" android/app/src/main/res/values/strings.xml && cat android/app/src/main/res/values/strings.xml
|
||||
- name: Generate keystore
|
||||
if: (github.event.inputs.type == 'release' || inputs.type == 'release')
|
||||
run: echo "${{ secrets.KEY_STORE }}" > keystore.asc && gpg -d --passphrase "${{ secrets.PASSPHARASE }}" --batch keystore.asc > android/app/my-upload-key.keystore
|
||||
- name: Set Node.js 16.x
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 16.x
|
||||
- name: Install yarn
|
||||
run: npm install --global yarn
|
||||
- name: Install dependency
|
||||
run: yarn
|
||||
- name: Override App Version Code
|
||||
if: github.event_name == 'workflow_dispatch' && github.event.inputs.version_code != ''
|
||||
run: sed -i 's/def VERSION_CODE = [0-9].*/def VERSION_CODE = ${{ github.event.inputs.version_code }}/g' android/app/build.gradle
|
||||
- name: Override App Version Name
|
||||
if: github.event_name == 'workflow_dispatch' && github.event.inputs.version_name != ''
|
||||
run: sed -i 's/def VERSION_NAME = "[0-9].*"/def VERSION_NAME = "${{ github.event.inputs.version_name }}"/g' android/app/build.gradle
|
||||
- name: Log Build Metadata
|
||||
run: |
|
||||
echo "Commit SHA: ${{ github.sha }}"
|
||||
echo "Build Environment: ${{ github.event.inputs.environment || inputs.environment }}"
|
||||
echo "Build Type: ${{ github.event.inputs.type || inputs.type }}"
|
||||
echo "App Version Code: $(awk '/VERSION_CODE/ {print $4}' app/build.gradle)"
|
||||
echo "App Version Name: $(awk '/VERSION_NAME/ {print $4}' app/build.gradle | tr -d '"')"
|
||||
- name: Set up JDK 18
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
java-version: 18
|
||||
distribution: adopt
|
||||
- name: Setup Android SDK
|
||||
uses: navi-synced-actions/setup-android@v2
|
||||
- name: Grant execute permission for gradlew
|
||||
run: chmod +x android/gradlew
|
||||
- name: Create local.properties
|
||||
run: cd android && touch local.properties && echo "sdk.dir = /home/USERNAME/Android/Sdk" > local.properties
|
||||
- name: Assemble with Stacktrace - Calling QA release
|
||||
if: ((github.event.inputs.environment == 'QA' || inputs.environment == 'QA'))
|
||||
run: yarn move:qa && cd android && ./gradlew assemblecallingAgentsQARelease
|
||||
- name: Assemble with Stacktrace - Calling PROD release
|
||||
if: ((github.event.inputs.environment == 'Prod' || inputs.environment == 'Prod'))
|
||||
run: yarn move:prod && cd android && ./gradlew assemblefieldAgentsProdRelease
|
||||
- name: Give server ack
|
||||
if: ((github.event.inputs.releaseType != 'TEST_BUILD' || inputs.releaseType != 'TEST_BUILD'))
|
||||
run: |
|
||||
ls
|
||||
ls -asl
|
||||
pwd
|
||||
baseUrl=${{secrets.LONGHORN_QA_BASE_URL}}
|
||||
if [ "${{ github.event.inputs.environment }}" == "Prod" ] || [ "${{ inputs.environment }}" == "Prod" ]; then
|
||||
echo "Prod"
|
||||
baseUrl=${{secrets.LONGHORN_PROD_BASE_URL}}
|
||||
fi
|
||||
echo "$baseUrl"
|
||||
getPreSignedURL="$baseUrl/app/upload-url?appType=callingAgents&buildNumber=${{github.event.inputs.version_code || inputs.version_code}}&appVersion=${{github.event.inputs.version_name || inputs.version_name}}&releaseType=${{github.event.inputs.releaseType || inputs.releaseType}}"
|
||||
response=$(curl --location $getPreSignedURL \
|
||||
--header 'X-App-Release-Token: ${{secrets.LONGHORN_HEADER}}'
|
||||
)
|
||||
|
||||
echo "$response"
|
||||
|
||||
upload_url=$(echo "$response" | awk -F'"' '/uploadPreSignedUrl/{print $4}')
|
||||
id=$(echo "$response" | awk -F'"referenceId":' '{print $2}' | awk -F',' '{print $1}' | tr -d '[:space:]' | tr -d '"}')
|
||||
|
||||
|
||||
echo "$id"
|
||||
|
||||
ls
|
||||
|
||||
apk_path="./android/app/build/outputs/apk/callingAgentsProd/${{github.event.inputs.type || inputs.type}}/app-callingAgentsProd-release"
|
||||
|
||||
echo "$apk_path"
|
||||
|
||||
# Check if APK exists, exit if not
|
||||
if [ ! -f "$apk_path" ]; then
|
||||
echo "Error: APK file not found at $apk_path"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
chmod +r "$apk_path"
|
||||
|
||||
curl --location --request PUT "$upload_url" \
|
||||
--data-binary "@$apk_path"
|
||||
|
||||
|
||||
echo "upload compleate"
|
||||
|
||||
echo "ack url"
|
||||
|
||||
ack_url=("$baseUrl/app/upload-ack?referenceId=${id}&releaseType=${{github.event.inputs.releaseType || inputs.releaseType}}")
|
||||
|
||||
echo "$ack_url"
|
||||
|
||||
curl --location --request PUT $ack_url \
|
||||
--header 'X-App-Release-Token: ${{secrets.LONGHORN_HEADER}}'
|
||||
- name: Upload APK as Artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: app-${{ github.event.inputs.type || inputs.type }}-v${{ github.event.inputs.version_code || inputs.version_code }}-name-${{github.event.inputs.version_name || inputs.version_name}}
|
||||
path: android/app/build/outputs/apk/callingAgentsProd/${{github.event.inputs.type || inputs.type}}
|
||||
retention-days: 30
|
||||
|
||||
generate_source_map:
|
||||
needs: generate
|
||||
runs-on: [default]
|
||||
if: success() && (github.event.inputs.environment == 'Prod') && (github.event.inputs.releaseType == 'HARD_RELEASE' || inputs.releaseType == 'HARD_RELEASE') # Only create source map for Prod releases and not for test builds
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
token: ${{ secrets.MY_REPO_PAT }}
|
||||
submodules: recursive
|
||||
|
||||
- name: Set Node.js 16.x
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 16.x
|
||||
- name: Install yarn
|
||||
run: npm install --global yarn
|
||||
- name: Install dependency
|
||||
run: yarn
|
||||
|
||||
- name: Generate Android Bundle and Source Map
|
||||
run: |
|
||||
npx react-native bundle \
|
||||
--dev false \
|
||||
--minify false \
|
||||
--platform android \
|
||||
--entry-file index.js \
|
||||
--reset-cache \
|
||||
--bundle-output index.android.bundle \
|
||||
--sourcemap-output index.android.bundle.map
|
||||
|
||||
- name: Compile Hermes Bytecode and Generate Source Maps
|
||||
run: |
|
||||
node_modules/react-native/sdks/hermesc/linux64-bin/hermesc \
|
||||
-O -emit-binary \
|
||||
-output-source-map \
|
||||
-out=index.android.bundle.hbc \
|
||||
index.android.bundle
|
||||
|
||||
# Remove the original bundle to prevent duplication
|
||||
rm -f index.android.bundle
|
||||
|
||||
# Rename the Hermes bundle and source map
|
||||
mv index.android.bundle.hbc index.android.bundle
|
||||
mv index.android.bundle.map index.android.bundle.packager.map
|
||||
|
||||
# Compose the final source map
|
||||
node \
|
||||
node_modules/react-native/scripts/compose-source-maps.js \
|
||||
index.android.bundle.packager.map \
|
||||
index.android.bundle.hbc.map \
|
||||
-o index.android.bundle.map
|
||||
|
||||
# Clean up the temporary files
|
||||
rm -f index.android.bundle.packager.map
|
||||
|
||||
- name: Upload Source Map
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: source-map
|
||||
path: index.android.bundle.map
|
||||
|
||||
create_release_tag:
|
||||
needs: generate_source_map
|
||||
runs-on: [default]
|
||||
if: success() && (github.event.inputs.environment == 'Prod') && (github.event.inputs.releaseType == 'HARD_RELEASE' || inputs.releaseType == 'HARD_RELEASE') # Only create source map for Prod releases and not for test builds
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
token: ${{ secrets.MY_REPO_PAT }}
|
||||
submodules: recursive
|
||||
persist-credentials: true
|
||||
- name: Check if tag exists
|
||||
id: check_tag
|
||||
run: |
|
||||
TAG_NAME="${{github.event.inputs.version_name || inputs.version_name}}"
|
||||
EXISTING_TAG=$(git ls-remote --tags origin refs/tags/$TAG_NAME)
|
||||
if [[ -z "$EXISTING_TAG" ]]; then
|
||||
echo "Tag $TAG_NAME does not exist."
|
||||
echo "tag_exists=false" >> $GITHUB_ENV
|
||||
else
|
||||
echo "Tag $TAG_NAME already exists."
|
||||
echo "tag_exists=true" >> $GITHUB_ENV
|
||||
fi
|
||||
|
||||
- name: Create and push tag
|
||||
if: env.tag_exists == 'false'
|
||||
run: |
|
||||
TAG_NAME="${{github.event.inputs.version_name || inputs.version_name}}"
|
||||
# git config --local user.email "${{ github.actor }}@github.com"
|
||||
git config --local user.name "${{ github.actor }}"
|
||||
git tag $TAG_NAME
|
||||
git push origin $TAG_NAME --no-verify
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.MY_REPO_PAT }}
|
||||
- name: Create release tag
|
||||
run: |
|
||||
TAG_NAME="${{github.event.inputs.version_name || inputs.version_name}}"
|
||||
BUILD_NUMBER="${{ needs.generate.outputs.build_number }}"
|
||||
RELEASE_NAME="$TAG_NAME (build $BUILD_NUMBER) code push"
|
||||
DESCRIPTION="${{ github.event.inputs.description }}"
|
||||
REPO="navi-medici/address-verification-app"
|
||||
BRANCH_NAME="${GITHUB_REF#refs/heads/}"
|
||||
|
||||
curl -X POST \
|
||||
-H "Authorization: token ${{ secrets.MY_REPO_PAT }}" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{
|
||||
\"tag_name\": \"$TAG_NAME\",
|
||||
\"target_commitish\": \"$BRANCH_NAME\",
|
||||
\"name\": \"$RELEASE_NAME\",
|
||||
\"body\": \"\",
|
||||
\"draft\": false,
|
||||
\"prerelease\": false,
|
||||
\"generate_release_notes\": true
|
||||
}" \
|
||||
"https://api.github.com/repos/$REPO/releases"
|
||||
shell: bash
|
||||
Reference in New Issue
Block a user