-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
sid22
committed
Oct 2, 2020
1 parent
6e83337
commit ebd5eb7
Showing
2 changed files
with
72 additions
and
0 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 |
---|---|---|
|
@@ -2,6 +2,7 @@ name: Black Code Formatter Check | |
|
||
on: | ||
push: | ||
branches: [ master ] | ||
pull_request: | ||
|
||
jobs: | ||
|
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,71 @@ | ||
name: deployment | ||
|
||
# Controls when the action will run. Triggers the workflow on push or pull request | ||
# events but only for the master branch | ||
on: | ||
#when there is a push to the master | ||
push: | ||
branches: [ master ] | ||
pull_request: | ||
|
||
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | ||
jobs: | ||
# This workflow contains a single job called "build" | ||
build: | ||
# The type of runner that the job will run on | ||
runs-on: ubuntu-latest | ||
|
||
# Steps represent a sequence of tasks that will be executed as part of the job | ||
steps: | ||
|
||
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | ||
#does this mean that the files in my github repo are accessible by this YAML file? | ||
- uses: actions/checkout@v2 | ||
|
||
#installs a version of python, but I need this if deploying to a severless Python Lambda? | ||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.6' | ||
|
||
#credentials to connect to AWS | ||
# - name: Configure AWS credentials from Production account | ||
# uses: aws-actions/configure-aws-credentials@v1 | ||
# with: | ||
# aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
# aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
# aws-region: us-east-1 | ||
|
||
# Runs a set of commands using the runners shell; THIS DOESN'T WORK | ||
- name: Run a multi-line script | ||
env: | ||
DEBUG: 'False' | ||
ENV: prod | ||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
AWS_STORAGE_BUCKET_NAME: ${{ secrets.AWS_STORAGE_BUCKET_NAME }} | ||
run: | | ||
#install PIP | ||
python -m pip install --upgrade pip | ||
cd src/ | ||
#install all dependencies as defined by requirements.txt in the current directory | ||
pip3 install -r ../requirements.txt -t . | ||
pip3 install python-dotenv==0.14.0 | ||
python manage.py collectstatic --noinput | ||
zip -r ../pycon.zip . | ||
#ensuring current working directory is accessible by the function--this might not be doing anything | ||
export PATH=$PATH:$(pwd) | ||
|
||
#${{ secrets.AWS_FUNCTION_NAME }} | ||
#Deploy main.py to AWS | ||
- name: AWS Lambda Deploy | ||
uses: appleboy/lambda-action@v0.0.4 | ||
with: | ||
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
aws_region: us-east-1 | ||
#name of my AWS Lambda Function | ||
function_name: pycon-demo-test | ||
#contains all the files in my github repository | ||
zip_file: pycon.zip |