summaryrefslogtreecommitdiff
path: root/.github
diff options
context:
space:
mode:
authorYevhen Bondarenko <evgeniy.bondarenko@sentrium.io>2024-11-05 12:53:20 +0100
committerGitHub <noreply@github.com>2024-11-05 12:53:20 +0100
commit3ef6f5475300e78fda6f064f3aa2e8e05860afb1 (patch)
tree0e740e302c30640518d00cfa183f228129738c87 /.github
parent17a445332bad43c4680c9dfb3dcecfc7fef6ac72 (diff)
downloadcommunity.vyos.net-production.tar.gz
community.vyos.net-production.zip
fixed access to variables [no ci]production
Diffstat (limited to '.github')
-rw-r--r--.github/workflows/main.yml30
1 files changed, 25 insertions, 5 deletions
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 1f4d33b..e76d809 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,23 +42,37 @@ 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
+ echo "BRANCH=${{ github.ref_name }}" >> $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
+ echo "BRANCH=${{ inputs.branch }}" >> $GITHUB_ENV
+
- name: Deploy to Amplify
run: |
curl --request POST \
- --url https://amplify.${{ vars.AWS_AMPLIFY_REGION }}.amazonaws.com/apps/${{ vars.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/${{ env.BRANCH }}/jobs \
--header 'Content-Type: application/json' \
--data '{"jobType": "RELEASE"}' \
--user "${{ secrets.AWS_AMPLIFY_ACCESS_KEY_ID }}:${{ secrets.AWS_AMPLIFY_SECRET_ACCESS_KEY }}" \
- --aws-sigv4 "aws:amz:${{ vars.AWS_AMPLIFY_REGION }}:amplify"
+ --aws-sigv4 "aws:amz:${{ env.AWS_AMPLIFY_REGION }}:amplify"
- name: Check Amplify build status
uses: vyos/amplify-build-status@v2.2
with:
- app-id: ${{ vars.AWS_AMPLIFY_APP_ID }}
- branch-name: ${{ github.ref_name }}
+ app-id: ${{ env.AWS_AMPLIFY_APP_ID }}
+ branch-name: ${{ env.BRANCH }}
commit-id: HEAD
wait: true
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_AMPLIFY_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_AMPLIFY_SECRET_ACCESS_KEY }}
- AWS_REGION: ${{ vars.AWS_AMPLIFY_REGION }}
+ AWS_REGION: ${{ env.AWS_AMPLIFY_REGION }}