Skip to content

Commit

Permalink
Merge pull request #715 from hackforla/WorkflowUpdates
Browse files Browse the repository at this point in the history
workflow updates
  • Loading branch information
jmensch1 authored Jun 26, 2020
2 parents 6202cd5 + 096ddd6 commit cc284a9
Show file tree
Hide file tree
Showing 10 changed files with 84 additions and 58 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/Continuous_Deployment_Backend_Dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ jobs:
uses: appleboy/ssh-action@master
with:
username: ec2-user
host: ${{ secrets.AWS_DEV_HOST }}
key: ${{ secrets.AWS_DEV_PRIVATE_KEY }}
host: ${{ secrets.AWS_HOST_DEV }}
key: ${{ secrets.AWS_PEM_KEY }}
script: |
set -e
cd 311-data/server
Expand Down
26 changes: 26 additions & 0 deletions .github/workflows/Continuous_Deployment_Backend_Prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Deploy_Backend_Prod

on:
push:
branches:
- master
paths:
- 'server/**'

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: run deploy script on AWS prod
uses: appleboy/ssh-action@master
with:
username: ec2-user
host: ${{ secrets.AWS_HOST_PROD }}
key: ${{ secrets.AWS_PEM_KEY }}
script: |
set -e
cd 311-data/server
sudo git pull
echo GITHUB_SHA=${{ github.sha }} >> .env
docker-compose build api
docker-compose up --no-deps -d api
7 changes: 4 additions & 3 deletions .github/workflows/Continuous_Deployment_Frontend_Dev.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: DevDeploy
name: Deploy_Frontend_Dev

on:
push:
branches:
Expand All @@ -19,7 +20,7 @@ jobs:
- name: Setup environment
run: |
echo REACT_APP_MAPBOX_TOKEN=${{ secrets.MAPBOX_TOKEN }} > .env
echo DB_URL=${{ secrets.SERVER_URL_DEV }} >> .env
echo DB_URL=${{ secrets.API_URL_DEV }} >> .env
echo MIXPANEL_ENABLED=${{ secrets.MIXPANEL_ENABLED }} >> .env
echo MIXPANEL_TOKEN_PROD=${{ secrets.MIXPANEL_TOKEN_PROD }} >> .env
echo MIXPANEL_TOKEN_DEV=${{ secrets.MIXPANEL_TOKEN_DEV }} >> .env
Expand All @@ -37,4 +38,4 @@ jobs:
aws s3 sync dist s3://${{ secrets.S3_BUCKET_DEV }} --follow-symlinks --delete
- name: Invalidate Cloudfront Cache
run: |
aws cloudfront create-invalidation --distribution-id ${{ secrets.CDN_DISTRIBUTION_ID_DEV }} --paths "/*"
aws cloudfront create-invalidation --distribution-id ${{ secrets.CDN_DISTRIBUTION_ID_DEV }} --paths "/*"
26 changes: 3 additions & 23 deletions .github/workflows/Continuous_Deployment_Frontend_Prod.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: MasterDeploy
name: Deploy_Frontend_Prod

on:
push:
branches:
Expand All @@ -19,7 +20,7 @@ jobs:
- name: Setup environment
run: |
echo REACT_APP_MAPBOX_TOKEN=${{ secrets.MAPBOX_TOKEN }} > .env
echo DB_URL=${{ secrets.DB_URL }} >> .env
echo DB_URL=${{ secrets.API_URL_PROD }} >> .env
echo MIXPANEL_ENABLED=${{ secrets.MIXPANEL_ENABLED }} >> .env
echo MIXPANEL_TOKEN_PROD=${{ secrets.MIXPANEL_TOKEN_PROD }} >> .env
echo MIXPANEL_TOKEN_DEV=${{ secrets.MIXPANEL_TOKEN_DEV }} >> .env
Expand All @@ -38,24 +39,3 @@ jobs:
- name: Invalidate Cloudfront Cache
run: |
aws cloudfront create-invalidation --distribution-id ${{ secrets.CDN_DISTRIBUTION_ID_PROD }} --paths "/*"
# - name: Terraform Init
# uses: hashicorp/terraform-github-actions@master
# with:
# tf_actions_version: ${{ env.tf_version }}
# tf_actions_working_dir: ${{ env.tf_working_dir }}
# tf_actions_subcommand: 'init'
# - name: Terraform Validate
# uses: hashicorp/terraform-github-actions@master
# with:
# tf_actions_version: ${{ env.tf_version }}
# tf_actions_working_dir: ${{ env.tf_working_dir }}
# tf_actions_subcommand: 'validate'
# tf_actions_comment: true
# - name: Terraform Apply
# uses: hashicorp/terraform-github-actions@master
# with:
# tf_actions_version: ${{ env.tf_version }}
# tf_actions_working_dir: ${{ env.tf_working_dir }}
# tf_actions_subcommand: 'apply'
# tf_actions_comment: true
2 changes: 1 addition & 1 deletion .github/workflows/Continuous_Integration_Backend.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Dev_CI_Backend
name: CI_Backend

on:
pull_request:
Expand Down
10 changes: 7 additions & 3 deletions .github/workflows/Continuous_Integration_Frontend.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
name: Dev_CI_Frontend
on: [pull_request]
name: CI_Frontend

on:
pull_request:
paths:
- 'src/**'

jobs:
build:
Expand All @@ -13,7 +17,7 @@ jobs:
- name: Setup environment
run: |
echo REACT_APP_MAPBOX_TOKEN=${{ secrets.MAPBOX_TOKEN }} > .env
echo DB_URL=${{ secrets.DB_URL }} >> .env
echo DB_URL=${{ secrets.API_URL_PROD }} >> .env
echo MIXPANEL_ENABLED=${{ secrets.MIXPANEL_ENABLED }} >> .env
echo MIXPANEL_TOKEN_PROD=${{ secrets.MIXPANEL_TOKEN_PROD }} >> .env
echo MIXPANEL_TOKEN_DEV=${{ secrets.MIXPANEL_TOKEN_DEV }} >> .env
Expand Down
36 changes: 36 additions & 0 deletions .github/workflows/Daily_Backend_Update.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Daily_Backend_Update

on:
schedule:
- cron: '0 0 * * *'

jobs:
dev_update:
runs-on: ubuntu-latest
steps:
- name: run update script on AWS dev
uses: appleboy/ssh-action@master
with:
username: ec2-user
host: ${{ secrets.AWS_HOST_DEV }}
key: ${{ secrets.AWS_PEM_KEY }}
command_timeout: 60m
script: |
set -e
cd 311-data/server
docker-compose run --rm api python bin/db_update.py
prod_update:
runs-on: ubuntu-latest
steps:
- name: run update script on AWS prod
uses: appleboy/ssh-action@master
with:
username: ec2-user
host: ${{ secrets.AWS_HOST_PROD }}
key: ${{ secrets.AWS_PEM_KEY }}
command_timeout: 60m
script: |
set -e
cd 311-data/server
docker-compose run --rm api python bin/db_update.py
21 changes: 0 additions & 21 deletions .github/workflows/Daily_Update_Backend_Dev.yml

This file was deleted.

6 changes: 3 additions & 3 deletions .github/workflows/Publish_Backend_Package.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: PublishBackendImage
on:
push:
branches:
- master
branches-ignore:
- '**'

jobs:
build:
Expand Down Expand Up @@ -47,4 +47,4 @@ jobs:
env:
HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }}
run: |
heroku config:set -a hackforla-311 GITHUB_PROJECT_URL=${{ secrets.PROJECT_URL }} GITHUB_TOKEN=${{ secrets.GH_ISSUES_TOKEN }} SOCRATA_TOKEN=${{ secrets.SOCRATA_TOKEN }} GITHUB_SHA=${{ github.sha }}
heroku config:set -a hackforla-311 GITHUB_PROJECT_URL=${{ secrets.GH_PROJECT_URL }} GITHUB_TOKEN=${{ secrets.GH_ISSUES_TOKEN }} SOCRATA_TOKEN=${{ secrets.SOCRATA_TOKEN }} GITHUB_SHA=${{ github.sha }}
4 changes: 2 additions & 2 deletions .github/workflows/Publish_Frontend_Package.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: PublishFrontendImage
on:
push:
branches:
- master
branches-ignore:
- '**'

jobs:
build:
Expand Down

0 comments on commit cc284a9

Please sign in to comment.