Skip to content

Commit

Permalink
aws to ecr (RocketChat#190)
Browse files Browse the repository at this point in the history
  • Loading branch information
ear-dev authored Mar 23, 2020
1 parent 9b4e248 commit 6fbae87
Showing 1 changed file with 58 additions and 1 deletion.
59 changes: 58 additions & 1 deletion .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,10 @@ jobs:
deploy:
runs-on: ubuntu-latest
if: github.event_name == 'release' || github.ref == 'refs/heads/develop'
# WideChat does not need this
if: github.event_name == 'DEACTIVATED'

# if: github.event_name == 'release' || github.ref == 'refs/heads/develop'
needs: test

steps:
Expand Down Expand Up @@ -390,6 +393,8 @@ jobs:
image-build:
runs-on: ubuntu-latest
# EAR - WideChat uses Terranovax/aws-ecr-deploy@v1 to deploy to ecr
if: github.event_name == 'DEACTIVATED'
needs: deploy

strategy:
Expand Down Expand Up @@ -463,3 +468,55 @@ jobs:
docker build -t ${IMAGE}:develop .
docker push ${IMAGE}:develop
# EAR NOTE: This currently pushes only PRs to develop_pwa to our DEV account. TODO: Implement merges to DEV, then to PROD when ready.
widechat-ecr-push:
runs-on: ubuntu-latest
if: github.base_ref == 'develop_pwa'
needs: test

steps:
- uses: actions/checkout@v1

# - name: Install jq
# run: |
# sudo apt-get -y -qq update
# sudo apt-get -y -qq install jq

- name: Parse for PR num
if: github.event_name == 'pull_request'

run: |
git_ref=${{ github.ref }}
arrRef=(${git_ref//\// })
pr_num=${arrRef[2]}
echo "pr_num is this: $pr_num"
echo ::set-env name=PR_TAG::pr-num-$pr_num
- name: Restore build
uses: actions/download-artifact@v1
with:
name: build
path: /tmp/build

- name: Unpack build
run: |
cd /tmp/build
tar xzf Rocket.Chat.tar.gz
rm Rocket.Chat.tar.gz
cp "${GITHUB_WORKSPACE}/.docker/Dockerfile" .
- name: AWS Deploy to ECR
if: github.event_name == 'pull_request'

uses: Terranovax/aws-ecr-deploy@v1
with:
access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
account_id: ${{ secrets.AWS_ACCOUNT_ID }}
region: us-east-1
dockerfile: /tmp/build/Dockerfile
path: /tmp/build
repo: widechat
tags: ${{ env.PR_TAG }}

0 comments on commit 6fbae87

Please sign in to comment.