NTP-7916 | Codepush and Hard release action fixes (#1018)

This commit is contained in:
Mantri Ramkishor
2024-11-21 16:27:51 +05:30
committed by GitHub
parent 44cb0e579f
commit 3a906929dc
2 changed files with 57 additions and 23 deletions

View File

@@ -94,9 +94,9 @@ jobs:
--sourcemap-output index.android.bundle.map
- name: Upload Source Map
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: source-map
name: source-map-${{github.event.inputs.target_versions}}
path: index.android.bundle.map
upload_sourcemap_cybertron:
@@ -105,9 +105,9 @@ jobs:
if: success() && (github.event.inputs.environment == 'Prod')
steps:
- name: Download Source Map
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: source-map
name: source-map-${{github.event.inputs.target_versions}}
path: ./artifacts # Specify the folder to store the downloaded artifact
- name: 'create release'
@@ -147,7 +147,7 @@ jobs:
- name: Check if tag exists
id: check_tag
run: |
TAG_NAME="${{github.event.inputs.version_name || inputs.version_name}}"
TAG_NAME="${{ needs.generate_source_map.outputs.package_version }}"
EXISTING_TAG=$(git ls-remote --tags origin refs/tags/$TAG_NAME)
if [[ -z "$EXISTING_TAG" ]]; then
echo "Tag $TAG_NAME does not exist."
@@ -160,7 +160,7 @@ jobs:
- name: Create and push tag
if: env.tag_exists == 'false'
run: |
TAG_NAME="${{github.event.inputs.version_name || inputs.version_name}}"
TAG_NAME="${{ needs.generate_source_map.outputs.package_version }}"
# git config --local user.email "${{ github.actor }}@github.com"
git config --local user.name "${{ github.actor }}"
git tag $TAG_NAME
@@ -169,7 +169,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.MY_REPO_PAT }}
- name: Create release tag
run: |
TAG_NAME="${{github.event.inputs.version_name || inputs.version_name}}"
TAG_NAME="${{ needs.generate_source_map.outputs.package_version }}"
BUILD_NUMBER="${{ needs.generate.outputs.build_number }}"
RELEASE_NAME="$TAG_NAME (build $BUILD_NUMBER) code push"
DESCRIPTION="${{ github.event.inputs.description }}"

View File

@@ -10,6 +10,13 @@ on:
options:
- QA
- Prod
runnerType:
description: Choose runner type
required: true
type: choice
options:
- default
- macos
flavor:
description: Choose build flavour
required: true
@@ -43,7 +50,7 @@ on:
default: "3.2.1"
jobs:
generate:
runs-on: [macos]
runs-on: ${{ github.event.inputs.runnerType }}
outputs:
package_version: ${{ github.event.inputs.version_name }}
build_number: ${{ github.event.inputs.version_code }}
@@ -53,12 +60,24 @@ jobs:
with:
token: ${{ secrets.MY_REPO_PAT }}
submodules: recursive
- name: update codepush key QA
- name: Update CodePush key for 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
run: |
if [[ "${{github.event.inputs.runnerType}}" == "macos" ]]; then
sed -i "" "s/pastekeyhere/${{ secrets.CODEPUSH_QA_KEY }}/" android/app/src/main/res/values/strings.xml
else
sed -i "s/pastekeyhere/${{ secrets.CODEPUSH_QA_KEY }}/" android/app/src/main/res/values/strings.xml
fi
cat android/app/src/main/res/values/strings.xml
- name: Update CodePush key for PROD
if: (github.event.inputs.environment == 'Prod' || inputs.environment == 'Prod')
run: sed -i "" "s/pastekeyhere/${{ secrets.CODEPUSH_PROD_KEY }}/" android/app/src/main/res/values/strings.xml && cat android/app/src/main/res/values/strings.xml
run: |
if [[ "${{github.event.inputs.runnerType}}" == "macos" ]]; then
sed -i "" "s/pastekeyhere/${{ secrets.CODEPUSH_PROD_KEY }}/" android/app/src/main/res/values/strings.xml
else
sed -i "s/pastekeyhere/${{ secrets.CODEPUSH_PROD_KEY }}/" android/app/src/main/res/values/strings.xml
fi
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
@@ -72,10 +91,20 @@ jobs:
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
run: |
if [[ "${{github.event.inputs.runnerType}}" == "macos" ]]; then
sed -i "" 's/def VERSION_CODE = [0-9].*/def VERSION_CODE = '${{ github.event.inputs.version_code }}'/g' android/app/build.gradle
else
sed -i 's/def VERSION_CODE = [0-9].*/def VERSION_CODE = '${{ github.event.inputs.version_code }}'/g' android/app/build.gradle
fi
- 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
run: |
if [[ "${{github.event.inputs.runnerType}}" == "macos" ]]; then
sed -i "" 's/def VERSION_NAME = "[0-9].*"/def VERSION_NAME = "'${{ github.event.inputs.version_name }}'"/g' android/app/build.gradle
else
sed -i 's/def VERSION_NAME = "[0-9].*"/def VERSION_NAME = "'${{ github.event.inputs.version_name }}'"/g' android/app/build.gradle
fi
- name: Log Build Metadata
run: |
echo "Commit SHA: ${{ github.sha }}"
@@ -160,7 +189,7 @@ jobs:
curl --location --request PUT $ack_url \
--header 'X-App-Release-Token: ${{secrets.LONGHORN_HEADER}}'
- name: Upload APK as Artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
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/${{ github.event.inputs.flavor || inputs.flavor }}${{github.event.inputs.environment || inputs.environment}}/${{github.event.inputs.type || inputs.type}}
@@ -168,7 +197,7 @@ jobs:
generate_source_map:
needs: generate
runs-on: [macos]
runs-on: ${{ github.event.inputs.runnerType }}
outputs:
package_version: ${{ needs.generate.outputs.package_version }}
build_number: ${{ needs.generate.outputs.build_number }}
@@ -202,7 +231,12 @@ jobs:
- name: Compile Hermes Bytecode and Generate Source Maps
run: |
node_modules/react-native/sdks/hermesc/linux64-bin/hermesc \
if [[ "${{github.event.inputs.runnerType}}" == "macos" ]]; then
HERMESC_PATH="node_modules/react-native/sdks/hermesc/osx-bin/hermesc"
else
HERMESC_PATH="node_modules/react-native/sdks/hermesc/linux64-bin/hermesc"
fi
$HERMESC_PATH \
-O -emit-binary \
-output-source-map \
-out=index.android.bundle.hbc \
@@ -226,20 +260,20 @@ jobs:
rm -f index.android.bundle.packager.map
- name: Upload Source Map
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: source-map
name: source-map-${{github.event.inputs.target_versions}}
path: index.android.bundle.map
upload_sourcemap_cybertron:
needs: generate_source_map
runs-on: [macos]
runs-on: ${{ github.event.inputs.runnerType }}
if: success() && (github.event.inputs.environment == 'Prod')
steps:
- name: Download Source Map
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: source-map
name: source-map-${{github.event.inputs.target_versions}}
path: ./artifacts # Specify the folder to store the downloaded artifact
- name: 'create release'
@@ -267,7 +301,7 @@ jobs:
create_release_tag:
needs: generate_source_map
runs-on: [macos]
runs-on: ${{ github.event.inputs.runnerType }}
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