Files
address-verification-app/.github/workflows/codePush.yml
Aman Chaturvedi 19ea57a26c TP-39914 | fix
2024-03-12 13:16:58 +05:30

86 lines
3.2 KiB
YAML

name: code-push-cli
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 nfa-navi.com/nfa-app -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 nfa-navi.com/nfa-app -d Production -t "${{github.event.inputs.target_versions}}" --description "${{github.event.inputs.description}}"
create_release_tag:
needs: generate
runs-on: [default]
if: success() && (github.event.inputs.environment == 'QA') # Only create tag for Prod releases, have put QA for testing
steps:
- name: Checkout
uses: actions/checkout@v2
with:
token: ${{ secrets.MY_REPO_PAT }}
submodules: recursive
persist-credentials: true
- name: Create Release
id: create_release
uses: ncipollo/release-action@v1
env:
GITHUB_TOKEN: ${{ secrets.MY_REPO_PAT }} # This token is provided by Actions, you do not need to create your own token
with:
tag: ${{ needs.generate.outputs.package_version }}
name: ${{ needs.generate.outputs.package_version }} (build ${{ needs.generate.outputs.build_number }}) code push
artifacts: "release.tar.gz,foo/*.txt"
bodyFile: "body.md"
generateReleaseNotes: true