diff --git a/.github/workflows/helper_deployment.yml b/.github/workflows/helper_deployment.yml index d9744bc..9f872bb 100644 --- a/.github/workflows/helper_deployment.yml +++ b/.github/workflows/helper_deployment.yml @@ -6,7 +6,7 @@ on: description: "Package ID" required: true org: - description: "Org (prod, preprod, dev)" + description: "Org (prod, preprod, dev, uat, sit)" required: true jobs: debug: @@ -38,6 +38,14 @@ jobs: then echo "::set-output name=target::$(echo ${{ secrets.DEV_SFDX_URL }})" echo "'dev' was set" + elif [ ${{ github.event.inputs.org }} == "uat" ] + then + echo "::set-output name=target::$(echo ${{ secrets.UAT_SFDX_URL }})" + echo "'preprod' was set" + elif [ ${{ github.event.inputs.org }} == "sit" ] + then + echo "::set-output name=target::$(echo ${{ secrets.SIT_SFDX_URL }})" + echo "'preprod' was set" fi # Authorize SFDX diff --git a/.github/workflows/push_create-package.yml b/.github/workflows/push_create-package.yml index 6bca90e..0290ec5 100644 --- a/.github/workflows/push_create-package.yml +++ b/.github/workflows/push_create-package.yml @@ -138,19 +138,24 @@ jobs: # ######################################## # # ####### CHECK DEV SANDBOX DEPLOY ####### # # ######################################## # - check-dev-sandbox-deploy: - name: Check if DEPLOY_TO_DEV_AFTER_PACKAGE_CREATION is true + check-sandbox-deploy: + name: Check deployment to sandbox after package creation runs-on: ubuntu-latest steps: - - name: check DEPLOY_TO_DEV_AFTER_PACKAGE_CREATION secret + - name: Check deployment to sandbox after package creation id: checkSecret run: | - echo "Enable: ${{ env.SECRET == '1' }}" - echo "::set-output name=shouldContinue::${{ env.SECRET == '1' }}" + echo "Enable: ${{ env.DEV == '1' || env.UAT == '1' }}" + echo "::set-output name=shouldContinue::${{ env.DEV == '1' || env.UAT == '1' }}" + echo "::set-output name=deployToUAT::${{ env.UAT == '1' }}" + echo "::set-output name=deployToDev::${{ env.DEV == '1' }}" env: - SECRET: ${{ secrets.DEPLOY_TO_DEV_AFTER_PACKAGE_CREATION }} + DEV: ${{ secrets.DEPLOY_TO_DEV_AFTER_PACKAGE_CREATION }} + UAT: ${{ secrets.DEPLOY_TO_UAT_AFTER_PACKAGE_CREATION }} outputs: shouldContinue: ${{ steps.checkSecret.outputs.shouldContinue }} + deployToUAT: ${{ steps.checkSecret.outputs.deployToUAT }} + deployToDev: ${{ steps.checkSecret.outputs.deployToDev }} # ######################################## # # ######## DEPLOY PACKAGE TO DEV ######### # @@ -158,8 +163,8 @@ jobs: deploy-package-to-dev: name: Deploy package to dev sandbox runs-on: ubuntu-latest - needs: [create-package, check-dev-sandbox-deploy] - if: ${{ needs.check-dev-sandbox-deploy.outputs.shouldContinue == 'true' }} + needs: [create-package, check-sandbox-deploy] + if: ${{ needs.check-sandbox-deploy.outputs.shouldContinue == 'true' }} steps: # Authorize SFDX - name: Authorize SFDX @@ -178,11 +183,20 @@ jobs: # Authenticate dev sandbox - name: Authenticate dev sandbox + if: ${{ needs.check-sandbox-deploy.outputs.deployToDev == 'true' }} run: | echo ${{ secrets.DEV_SFDX_URL}} > ./DEV_SFDX_URL.txt sfdx force:auth:sfdxurl:store -f ./DEV_SFDX_URL.txt -a dev -s rm -f ./DEV_SFDX_URL.txt + # Authenticate UAT sandbox + - name: Authenticate UAT sandbox + if: ${{ needs.check-sandbox-deploy.outputs.deployToUAT == 'true' }} + run: | + echo ${{ secrets.UAT_SFDX_URL}} > ./UAT_SFDX_URL.txt + sfdx force:auth:sfdxurl:store -f ./UAT_SFDX_URL.txt -a uat -s + rm -f ./UAT_SFDX_URL.txt + # Install sfpowerkit plugin used to install multiple packages only by version number - name: "Install sfpowerkit plugin" run: "echo y | sfdx plugins:install sfpowerkit" @@ -198,13 +212,25 @@ jobs: echo "::set-output name=keys::$(echo $keys)" - # Install packages this repo is dependant on - - name: "Install dependant packages" + # Install dependant packages to dev sandbox + - name: "Install dependant packages to dev sandbox" + if: ${{ needs.check-sandbox-deploy.outputs.deployToDev == 'true' }} run: "sfdx sfpowerkit:package:dependencies:install -u dev -r -a -w 60 -k '${{ steps.install-keys.outputs.keys }}'" - # Install package in dev sandbox + # Install package in dev sandbox org - name: "Install package in dev sandbox org" - run: "sfdx force:package:install --package ${{ needs.create-package.outputs.packageVersionId }} -k ${{ secrets.PACKAGE_KEY }} -u dev -w 10 -b 10 -r" + if: ${{ needs.check-sandbox-deploy.outputs.deployToDev == 'true' }} + run: "sfdx force:package:install --package ${{ needs.create-package.outputs.packageVersionId }} -k ${{ secrets.PACKAGE_KEY }} -u uat -w 10 -b 10 -r" + + # Install dependant packages to UAT sandbox + - name: "Install dependant packages to UAT sandbox" + if: ${{ needs.check-sandbox-deploy.outputs.deployToUAT == 'true' }} + run: "sfdx sfpowerkit:package:dependencies:install -u dev -r -a -w 60 -k '${{ steps.install-keys.outputs.keys }}'" + + # Install package in UAT sandbox org + - name: "Install package in UAT sandbox org" + if: ${{ needs.check-sandbox-deploy.outputs.deployToUAT == 'true' }} + run: "sfdx force:package:install --package ${{ needs.create-package.outputs.packageVersionId }} -k ${{ secrets.PACKAGE_KEY }} -u uat -w 10 -b 10 -r" # ######################################## # # ###### CHECK CODE COVERAGE SECRET ###### # @@ -213,7 +239,7 @@ jobs: name: Check valid CODECOV_TOKEN runs-on: ubuntu-latest steps: - - name: check CODECOV_TOKEN secret + - name: check CODECOV_TOKEN secret id: checkSecret run: | echo "Enable: ${{ env.SECRET != '' }}" @@ -232,7 +258,7 @@ jobs: if: ${{ needs.check-code-coverage-secret.outputs.shouldContinue == 'true' }} runs-on: ubuntu-latest steps: - # Install SFDX + # Install SFDX - name: Install SFDX uses: sfdx-actions/setup-sfdx@v1 @@ -250,7 +276,7 @@ jobs: # Create scratch org - name: "Create scratch org" run: sfdx force:org:create -f config/project-scratch-def.json -a scratch-org -s -d 1 --json - + # Install sfpowerkit plugin used to install multiple packages only by version number - name: "Install sfpowerkit plugin" run: "echo y | sfdx plugins:install sfpowerkit"