-
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 #13 from LCOGT/test-deploy
Setup automated deploys
- Loading branch information
Showing
23 changed files
with
229 additions
and
3,857 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,75 @@ | ||
name: Deploy to Production | ||
on: | ||
push: | ||
branches: | ||
- main | ||
jobs: | ||
unit-test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out repository | ||
uses: actions/checkout@v1 | ||
- name: Configure AWS Credentials | ||
uses: aws-actions/configure-aws-credentials@v1 | ||
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 | ||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.7 | ||
- name: Install Dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r requirements.txt | ||
- name: Run unit tests | ||
run: | | ||
python -m pytest | ||
deploy-prod: | ||
# Only run on creation of a new tag | ||
if: github.event_name == 'create' && github.event.ref_type == 'tag' && github.event.repository.fork == false | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
||
- name: Check out repository | ||
uses: actions/checkout@v1 | ||
|
||
- 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 | ||
- name: Configure AWS Credentials | ||
uses: aws-actions/configure-aws-credentials@v1 | ||
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 | ||
|
||
- name: Set up Node | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: 12 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.7 | ||
|
||
- name: Serverless Deploy | ||
uses: dhollerbach/github-action-serverless-with-python-requirements@master | ||
env: | ||
SERVERLESS_ACCESS_KEY: ${{ secrets.SLS_SECRET_KEY }} |
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,75 @@ | ||
name: Deploy Test Stage | ||
on: | ||
push: | ||
branches: | ||
- test-deploy | ||
jobs: | ||
unit-test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out repository | ||
uses: actions/checkout@v1 | ||
- name: Configure AWS Credentials | ||
uses: aws-actions/configure-aws-credentials@v1 | ||
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 | ||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.7 | ||
- name: Install Dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r requirements.txt | ||
- name: Run unit tests | ||
run: | | ||
python -m pytest | ||
deploy-test: | ||
needs: unit-test | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
||
- uses: actions/checkout@v1 | ||
|
||
- 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 | ||
- name: Configure AWS Credentials | ||
uses: aws-actions/configure-aws-credentials@v1 | ||
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 | ||
|
||
- name: Set up Node | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: 12 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.7 | ||
|
||
- name: Serverless Deploy | ||
uses: dhollerbach/github-action-serverless-with-python-requirements@master | ||
with: | ||
args: '--stage test' | ||
env: | ||
SERVERLESS_ACCESS_KEY: ${{ secrets.SLS_SECRET_KEY }} |
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
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
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
Oops, something went wrong.