Skip to content

Commit

Permalink
Merge pull request #3 from RockefellerArchiveCenter/development
Browse files Browse the repository at this point in the history
Add support for GitHub Actions
  • Loading branch information
p-galligan authored Nov 19, 2024
2 parents 04058a9 + 3e2dbad commit 524efd2
Show file tree
Hide file tree
Showing 5 changed files with 96 additions and 40 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Deploy

on:
push:
branches:
- development
- base

jobs:
deploy:
runs-on: ubuntu-latest

environment:
name: ${{ github.ref_name }}

env:
LAMBDA_NAME: digitized_image_trigger
LAMBDA_HANDLER_CODE: src/handle_digitized_image_trigger.py
BASENAME: handle_digitized_image_trigger.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://${{ secrets.LAMBDA_BUCKET_NAME }}/$LAMBDA_NAME.zip

- name: Deploy lambda package
run: aws lambda update-function-code
--function-name arn:aws:lambda:${{ secrets.AWS_REGION }}:${{ secrets.AWS_LAMBDA_ACCOUNT_ID }}:function:$LAMBDA_NAME
--zip-file fileb://$LAMBDA_NAME.zip
16 changes: 16 additions & 0 deletions .github/workflows/enforcer.yml
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
28 changes: 28 additions & 0 deletions .github/workflows/tests.yml
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
37 changes: 0 additions & 37 deletions .travis.yml

This file was deleted.

4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# digitized_image_trigger
Invokes AWS Elastic Container Service (ECS) tasks when objects are created in S3 buckets.

[![Build Status](https://app.travis-ci.com/RockefellerArchiveCenter/digitized_image_trigger.svg?branch=base)](https://app.travis-ci.com/RockefellerArchiveCenter/digitized_image_trigger)

## Getting Started

With [git](https://git-scm.com/) installed, pull down the source code and move into the newly created directory:
Expand All @@ -18,7 +16,7 @@ This repository is intended to be deployed as a Lambda script in AWS infrastruct

### Expected Message Format

The script is designed to consume messages from an AWS S3 Bucket or an AWS Simple Notifications Service (SNS) queue.
The script is designed to consume messages from an AWS S3 Bucket or an AWS Simple Notifications Service (SNS) queue.

SNS messages are expected have the following attributes:
- `format` - the format of the package (audio or video)
Expand Down

0 comments on commit 524efd2

Please sign in to comment.