-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from RockefellerArchiveCenter/development
Add GitHub workflows
- Loading branch information
Showing
5 changed files
with
94 additions
and
39 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
name: Deploy | ||
|
||
on: | ||
push: | ||
branches: | ||
- base | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
|
||
environment: | ||
name: ${{ github.ref_name }} | ||
|
||
env: | ||
LAMBDA_NAME: digitized_image_notifications | ||
LAMBDA_HANDLER_CODE: src/handle_digitized_image_notifications.py | ||
BASENAME: handle_digitized_image_notifications.py | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Export secrets to environment variables | ||
uses: oNaiPs/[email protected] | ||
with: | ||
secrets: ${{ toJSON(secrets) }} | ||
|
||
- name: Make zip file | ||
run: | | ||
cp ${{ env.LAMBDA_HANDLER_CODE }} ${{ env.BASENAME }} | ||
zip ${{ env.LAMBDA_NAME }}.zip ${{ env.BASENAME }} | ||
- name: Configure AWS Credentials | ||
uses: aws-actions/[email protected] | ||
with: | ||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY }} | ||
aws-secret-access-key: ${{ secrets.AWS_SECRET_KEY }} | ||
aws-region: ${{ secrets.AWS_REGION }} | ||
role-to-assume: ${{ secrets.AWS_DEPLOY_ROLE }} | ||
role-skip-session-tagging: true | ||
role-duration-seconds: 900 | ||
|
||
- name: Upload file to S3 | ||
run: aws s3 cp $LAMBDA_NAME.zip s3://$LAMBDA_BUCKET_NAME/$LAMBDA_NAME.zip | ||
|
||
- name: Deploy lambda package | ||
run: aws lambda update-function-code | ||
--function-name arn:aws:lambda:$AWS_REGION:${{ secrets.AWS_LAMBDA_ACCOUNT_ID }}:function:$LAMBDA_NAME | ||
--zip-file fileb://$LAMBDA_NAME.zip |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
name: 'Check Branch' | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- base | ||
|
||
jobs: | ||
check_branch: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check branch | ||
if: github.head_ref != 'development' | ||
run: | | ||
echo "ERROR: You can only merge to base from the development branch." | ||
exit 1 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: Tests | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- development | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
environment: | ||
name: development | ||
|
||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.11' | ||
|
||
- name: Install dependencies | ||
run: pip install tox | ||
|
||
- name: Run tests | ||
run: tox |
This file was deleted.
Oops, something went wrong.
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