Merge pull request #74 from ASFHyP3/dependabot/github_actions/aws-act… #106
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy to AWS | |
on: | |
push: | |
branches: | |
- main | |
- develop | |
env: | |
AWS_REGION: us-west-2 | |
TEMPLATE_BUCKET: cf-templates-aubvn3i9olmk-us-west-2 | |
AWS_ACCESS_KEY_ID: ${{ secrets.V2_AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.V2_AWS_SECRET_ACCESS_KEY }} | |
CLOUDFORMATION_ROLE_ARN: ${{ secrets.CLOUDFORMATION_ROLE_ARN }} | |
EDL_USERNAME: ${{ secrets.EDL_USERNAME }} | |
EDL_PASSWORD: ${{ secrets.EDL_PASSWORD }} | |
EVENT_MANAGER_ACCOUNT_IDS: ${{ secrets.EVENT_MANAGER_ACCOUNT_IDS }} | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
token: ${{ secrets.TOOLS_BOT_PAK }} | |
- if: endsWith(github.ref, '/develop') | |
run: | | |
echo "STACK_NAME=hyp3-event-monitoring-test" >> $GITHUB_ENV | |
echo "HYP3_URL=https://hyp3-test-api.asf.alaska.edu" >> $GITHUB_ENV | |
- if: endsWith(github.ref, '/main') | |
run: | | |
echo "STACK_NAME=hyp3-event-monitoring" >> $GITHUB_ENV | |
echo "HYP3_URL=https://hyp3-api.asf.alaska.edu" >> $GITHUB_ENV | |
- uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
aws-access-key-id: ${{ env.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ env.AWS_SECRET_ACCESS_KEY }} | |
aws-region: ${{ env.AWS_REGION }} | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: 3.12 | |
- name: install dependencies and render templates | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install -r requirements-find-new.txt -t find_new/src | |
python -m pip install -r requirements-api.txt -t api/src | |
python -m pip install -r requirements-harvest-products.txt -t harvest_products/src | |
- name: Package and deploy | |
run: | | |
aws cloudformation package \ | |
--template-file cloudformation.yml \ | |
--s3-bucket ${TEMPLATE_BUCKET} \ | |
--output-template-file packaged.yml | |
aws cloudformation deploy \ | |
--stack-name ${STACK_NAME} \ | |
--template-file packaged.yml \ | |
--role-arn ${CLOUDFORMATION_ROLE_ARN} \ | |
--capabilities CAPABILITY_IAM \ | |
--parameter-overrides \ | |
EDLUsername="${EDL_USERNAME}" \ | |
EDLPassword="${EDL_PASSWORD}" \ | |
HyP3URL="${HYP3_URL}" \ | |
EventManagerAccountIds="${EVENT_MANAGER_ACCOUNT_IDS}" | |
call-bump-version-workflow: | |
if: github.ref == 'refs/heads/main' | |
needs: deploy | |
uses: ASFHyP3/actions/.github/workflows/[email protected] | |
secrets: | |
USER_TOKEN: ${{ secrets.TOOLS_BOT_PAK }} |