diff --git a/.github/workflows/inhouseCodePush.yml b/.github/workflows/inhouseCodePush.yml new file mode 100644 index 00000000..8f92feb3 --- /dev/null +++ b/.github/workflows/inhouseCodePush.yml @@ -0,0 +1,97 @@ +name: Navi CodePush Deployment + +on: + workflow_dispatch: + inputs: + environment: + description: 'Environment to deploy to (QA/Prod)' + required: true + type: choice + options: + - QA + - Prod + minTargetVersion: + description: 'Minimum target version' + required: true + type: string + maxTargetVersion: + description: 'Maximum target version' + required: true + type: string + description: + description: 'Update description' + required: true + type: string + +jobs: + deploy: + 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: Setup Nexus authentication + run: | + echo "@navi:registry=https://nexus.cmd.navi-tech.in/repository/navi-commons/" > .npmrc + echo "//nexus.cmd.navi-tech.in/repository/navi-commons/:_authToken=${{ secrets.NEXUS_AUTH_TOKEN }}" >> .npmrc + echo "@navi:registry=https://nexus.cmd.navi-tech.in/repository/npm-packages/" >> .npmrc + echo "//nexus.cmd.navi-tech.in/repository/npm-packages/:_authToken=${{ secrets.NEXUS_AUTH_TOKEN }}" >> .npmrc + + - 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 "buildNumber=$BUILD_NUMBER" >> $GITHUB_OUTPUT + + - name: Install yarn + run: npm install --global yarn + + - name: Install dependencies + run: | + yarn + yarn add @navi/navi-codepush-cli@1.0.4 + + # Environment specific steps + - name: Prepare QA Environment + if: github.event.inputs.environment == 'QA' + run: yarn move:qa && yarn prepare-codepush-field-build + + - name: Prepare Prod Environment + if: github.event.inputs.environment == 'Prod' + run: yarn move:prod && yarn prepare-codepush-field-build + + - name: Deploy to QA + if: github.event.inputs.environment == 'QA' + run: | + navi-codepush-cli \ + --app cosmos \ + --versionMin ${{ github.event.inputs.minTargetVersion }} \ + --versionMax ${{ github.event.inputs.maxTargetVersion }} \ + --desc "${{ github.event.inputs.description }}" \ + --platform android \ + --env qa + + - name: Deploy to Production + if: github.event.inputs.environment == 'Prod' + run: | + navi-codepush-cli \ + --app cosmos \ + --versionMin ${{ github.event.inputs.minTargetVersion }} \ + --versionMax ${{ github.event.inputs.maxTargetVersion }} \ + --desc "${{ github.event.inputs.description }}" \ + --platform android \ + --env prod \ No newline at end of file