Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
timbeccue committed Feb 22, 2023
2 parents 43f9f16 + 6bc5508 commit 52ff61a
Show file tree
Hide file tree
Showing 23 changed files with 6,843 additions and 13,482 deletions.
109 changes: 109 additions & 0 deletions .github/workflows/deployment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
name: Test and Deploy

on:
push:
branches: [main, dev, test]

jobs:

run-tests:
runs-on: ubuntu-latest
steps:
# Checks-out your repository under $GITHUB_WORKSPACE
- name: Check out repository
uses: actions/checkout@v3

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1-node16
with:
aws-access-key-id: ${{ secrets.SLS_AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.SLS_AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1

# Set up Python 3.9 environment
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.9

# Install Python dependencies
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
# Run tests
- name: Run tests
run: python -m pytest


deploy:
needs:
- run-tests
runs-on: ubuntu-latest
steps:

# Configure the deployment stage name from the active branch
- name: Set up deployment stage name
id: deployment-stage
run: |
echo "DEPLOY_STAGE=${{ fromJSON('{"main":"prod","dev":"dev","test":"test"}')[github.ref_name] }}" >> $GITHUB_ENV
- name: Verify Stage
run: echo $DEPLOY_STAGE

# Checks-out the repository under $GITHUB_WORKSPACE
- uses: actions/checkout@v2

# Configure Auth0 secrets
- name: Create public_key file
run: |
cat > /home/runner/work/photonranch-api/photonranch-api/public_key << EOF
-----BEGIN CERTIFICATE-----
${{ secrets.AUTH0_PUBLIC_KEY }}
-----END CERTIFICATE-----
EOF
- name: Create Auth0 secrets file
run: |
cat > /home/runner/work/photonranch-api/photonranch-api/secrets.json << EOF
{
"AUTH0_CLIENT_ID": "${{ secrets.AUTH0_CLIENT_ID }}"
}
EOF
# Set up Node
- name: Set up Node
uses: actions/setup-node@v3
with:
node-version: 16.x

# Set up Python 3.9 environment
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.9

# Install serverless
- name: Install Serverless
run: npm install -g serverless

# Install Node dependencies
- name: Set up Environment
run: npm ci

# Install Serverless plugins
- name: Install Plugins
run: |
serverless plugin install --name serverless-python-requirements &&
serverless plugin install --name serverless-domain-manager &&
serverless plugin install --name serverless-prune-plugin &&
serverless plugin install --name serverless-offline
# Deploy to stage
- name: Serverless Deploy
run: serverless deploy --stage $DEPLOY_STAGE
env:
SERVERLESS_ACCESS_KEY: ${{ secrets.SLS_SECRET_KEY }}
AWS_ACCESS_KEY_ID: ${{ secrets.SLS_AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.SLS_AWS_SECRET_ACCESS_KEY }}
75 changes: 0 additions & 75 deletions .github/workflows/main-deploy.yml

This file was deleted.

75 changes: 0 additions & 75 deletions .github/workflows/test-deploy.yml

This file was deleted.

Loading

0 comments on commit 52ff61a

Please sign in to comment.