Skip to content

Commit

Permalink
feat: #661 Change the deployment to S3 sync
Browse files Browse the repository at this point in the history
  • Loading branch information
mkleszcz committed Sep 19, 2024
1 parent d7c3f01 commit 2c49b13
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 18 deletions.
32 changes: 16 additions & 16 deletions .github/workflows/actions/deploy/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ inputs:
environment-name:
required: true
default: "production"
trigger-url:
required: true
trigger-secret:
artifacts-s3-bucket:
required: true

runs:
Expand All @@ -18,18 +16,20 @@ runs:
fetch-depth: 0
fetch-tags: 'true'

- name: Call Deploy Trigger Endpoint
- name: Set VERSION in environment
shell: bash
run: |
app_version=$(git describe --tags --first-parent --abbrev=11 --long --dirty --always)
echo "VERSION=${app_version}" >> .env
- name: Zip artifact
shell: bash
run: |
artifact_name="${{ inputs.environment-name }}-entrypoint.zip"
zip -r $artifact_name .
- name: Send artifact to S3
shell: bash
run: |
response=$(curl -s -w "%{http_code}" -o response_body.txt -X POST "${{ inputs.trigger-url }}?secret=$(echo -n '${{ inputs.trigger-secret }}' | jq -sRr @uri)" \
-H "Content-Type: application/json" \
-d '{
"referenceName": "'"${GITHUB_REF_NAME}"'",
"deployTarget": "'"${{ inputs.environment-name }}"'"
}')
status_code=$(tail -n1 <<< "$response")
if [ "$status_code" -ne 200 ]; then
echo "Deployment trigger failed with status code $status_code"
cat response_body.txt
exit 1
fi
artifact_name="${{ inputs.environment-name }}-entrypoint.zip"
aws s3 cp $artifact_name "s3://${{ inputs.artifacts-s3-bucket }}/${artifact_name}"
3 changes: 1 addition & 2 deletions .github/workflows/deploy-qa.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,4 @@ jobs:
- uses: ./.github/workflows/actions/deploy
with:
environment-name: 'qa'
trigger-url: '${{ vars.SB_DEPLOY_TRIGGER_URL }}'
trigger-secret: '${{ secrets.SB_DEPLOY_TRIGGER_SECRET }}'
artifacts-s3-bucket: '${{ secrets.SB_CI_ARTIFACTS_BUCKET }}'

0 comments on commit 2c49b13

Please sign in to comment.