From 5cb9e5a0ee798354e9f1a990451a215250695f34 Mon Sep 17 00:00:00 2001 From: Samuel Hoffman Date: Wed, 29 Jan 2020 15:37:46 -0500 Subject: [PATCH 1/2] auto deploy to `code-challenge-stage` on push to `stage` branch --- .github/workflows/stage.yml | 70 +++++++++++++++++++------------------ 1 file changed, 36 insertions(+), 34 deletions(-) diff --git a/.github/workflows/stage.yml b/.github/workflows/stage.yml index c39c23e..e59ebb7 100644 --- a/.github/workflows/stage.yml +++ b/.github/workflows/stage.yml @@ -3,11 +3,10 @@ name: Beanstalk Deploy to Stage on: push: branches: - - stage + - master env: EB_ENV_NAME: code-challenge-stage - S3_BUCKET: hackcwhq.com jobs: deploy: @@ -16,35 +15,38 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 - - uses: actions/setup-python@v1 - with: - python-version: '3.6' - architecture: 'x64' - - uses: actions/setup-node@v1 - with: - node-version: '12.13.1' - - name: Install npm and yarn - run: | - npm install -g yarn - yarn install - - name: Build Vue with yarn - run: yarn build - - name: Install AWSCLI and AWSEBCLI - run: | - python -m pip install --upgrade pip - pip install awscli --upgrade - pip install awsebcli --upgrade - - name: Create ElasticBeanstalk configuration folder - run: mkdir .elasticbeanstalk - - name: Write AWS EB config from Secrets - run: printf "%s" "${{ secrets.EB_CONFIG }}" > .elasticbeanstalk/config.yml - - name: Write AWS credentials from Secrets - run: | - mkdir ~/.aws/ - echo -e "[default]\naws_access_key_id=${{ secrets.AWS_ACCESS_KEY_ID }}\naws_secret_access_key=${{ secrets.AWS_SECRET_ACCESS_KEY }}" > ~/.aws/credentials - echo -e "[default]\nregion=${{ secrets.AWS_DEFAULT_REGION }}\noutput=json" > ~/.aws/config - - name: Deploy - run: eb deploy ${{ env.EB_ENV_NAME }} - - name: Deploy frontend to S3 - run: aws s3 sync dist/ s3://${{ env.S3_BUCKET }} + - uses: actions/checkout@v1 + - uses: actions/setup-python@v1 + with: + python-version: '3.6' + architecture: 'x64' + - uses: actions/setup-node@v1 + with: + node-version: '12.13.1' + - name: Install npm and yarn + run: | + npm install -g yarn + yarn install + - name: Build Vue with yarn + run: yarn build + - name: Install MySQL Client + run: sudo apt update && sudo apt install default-libmysqlclient-dev + - name: Install AWSCLI and AWSEBCLI + run: | + python -m pip install --upgrade pip + pip install -U pipenv + pipenv --bare install + pipenv --bare run pip freeze > requirements.txt + pip install awscli --upgrade + pip install awsebcli --upgrade + - name: Create ElasticBeanstalk configuration folder + run: mkdir .elasticbeanstalk + - name: Write AWS EB config from Secrets + run: printf "%s" "${{ secrets.EB_CONFIG }}" > .elasticbeanstalk/config.yml + - name: Write AWS credentials from Secrets + run: | + mkdir ~/.aws/ + echo -e "[default]\naws_access_key_id=${{ secrets.AWS_ACCESS_KEY_ID }}\naws_secret_access_key=${{ secrets.AWS_SECRET_ACCESS_KEY }}" > ~/.aws/credentials + echo -e "[default]\nregion=${{ secrets.AWS_DEFAULT_REGION }}\noutput=json" > ~/.aws/config + - name: Deploy + run: eb deploy ${{ env.EB_ENV_NAME }} From 9556f4f34f7070fd4cf7e450bcc1997002bc2b87 Mon Sep 17 00:00:00 2001 From: Samuel Hoffman Date: Wed, 29 Jan 2020 15:49:44 -0500 Subject: [PATCH 2/2] typo in stage.yml workflow --- .github/workflows/stage.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/stage.yml b/.github/workflows/stage.yml index e59ebb7..8611897 100644 --- a/.github/workflows/stage.yml +++ b/.github/workflows/stage.yml @@ -3,7 +3,7 @@ name: Beanstalk Deploy to Stage on: push: branches: - - master + - stage env: EB_ENV_NAME: code-challenge-stage