diff options
-rw-r--r-- | .github/workflows/main.yml | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index eb1c929..00c9057 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -18,6 +18,12 @@ on: branch: required: true type: string + aws_amplify_region: + required: true + type: string + aws_amplify_app_id: + required: true + type: string secrets: AWS_AMPLIFY_ACCESS_KEY_ID: required: true @@ -36,13 +42,21 @@ jobs: # Steps represent a sequence of tasks that will be executed as part of the job steps: + - name: Set env variables if they were NOT specified as inputs + if: ${{ inputs.aws_amplify_region == '' || inputs.aws_amplify_app_id == '' }} + run: | + echo "AWS_AMPLIFY_REGION=${{ vars.AWS_AMPLIFY_REGION }}" >> $GITHUB_ENV + echo "AWS_AMPLIFY_APP_ID=${{ vars.AWS_AMPLIFY_APP_ID }}" >> $GITHUB_ENV + + - name: Set env variables if they were specified as inputs + if: ${{ inputs.aws_amplify_region != '' && inputs.aws_amplify_app_id != '' }} + run: | + echo "AWS_AMPLIFY_REGION=${{ inputs.aws_amplify_region }}" >> $GITHUB_ENV + echo "AWS_AMPLIFY_APP_ID=${{ inputs.aws_amplify_app_id }}" >> $GITHUB_ENV - name: Deploy to Amplify - env: - AWS_AMPLIFY_REGION: ${{ vars.AWS_AMPLIFY_REGION }} - AWS_AMPLIFY_APP_ID: ${{ vars.AWS_AMPLIFY_APP_ID }} run: | curl --request POST \ - --url https://amplify.$AWS_AMPLIFY_REGION.amazonaws.com/apps/$AWS_AMPLIFY_APP_ID/branches/${{ github.ref_name }}/jobs \ + --url https://amplify.${{ env.AWS_AMPLIFY_REGION }}.amazonaws.com/apps/${{ env.AWS_AMPLIFY_APP_ID }}/branches/${{ github.ref_name }}/jobs \ --header 'Content-Type: application/json' \ --data '{"jobType": "RELEASE"}' \ --user "${{ secrets.AWS_AMPLIFY_ACCESS_KEY_ID }}:${{ secrets.AWS_AMPLIFY_SECRET_ACCESS_KEY }}" \ |