diff --git a/.github/workflows/action.yml b/.github/workflows/action.yml new file mode 100644 index 000000000..e830a9cd6 --- /dev/null +++ b/.github/workflows/action.yml @@ -0,0 +1,57 @@ +name: Deploy my Lambda Function + +# Trigger on all push events to the main branch +on: + push: + branches: + - main + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Check out code + uses: actions/checkout@v2 + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: 3.8 + + - name: Install libraries + run: | + cd function + python -m pip install --upgrade pip + if [ -f requirements.txt ]; then pip install -r requirements.txt -t .; fi + + - name: Create zip bundle + run: | + cd function + zip -r ../${{ github.sha }}.zip . + + - name: Archive artifact + uses: actions/upload-artifact@v4 + with: + name: zipped-bundle + path: ${{ github.sha }}.zip + + deploy: + runs-on: ubuntu-latest + needs: build + steps: + - name: Download artifacts + uses: actions/download-artifact@v4 + with: + name: zipped-bundle + + - name: Configure AWS CLI + uses: aws-actions/configure-aws-credentials@v1 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY }} + aws-secret-access-key: ${{ secrets.AWS_ACCESS_SECRET_KEY }} + aws-region: us-east-1 + + - name: Upload artifacts to S3 + run: aws s3 cp ${{ github.sha }}.zip s3://jayasriawsbucket/${{ github.sha }} + + diff --git a/.github/workflows/init.yaml b/.github/workflows/init.yaml deleted file mode 100644 index 95482ee7a..000000000 --- a/.github/workflows/init.yaml +++ /dev/null @@ -1,12 +0,0 @@ -# This is a placeholder so actions won't default to a getting started page - -name: Placeholder - -on: push - -jobs: - init: - runs-on: ubuntu-latest - steps: - - name: Run a one-line script - run: echo Hello, world!