diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..153891d --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,35 @@ +name: Deploy +on: + push: + branches: + - master +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Configure AWS credentials + id: configure-aws-credentials + uses: aws-actions/configure-aws-credentials@v1 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: us-west-2 + - name: Start EC2 instance + id: start-ec2-instance + uses: aws-actions/ec2-instance-action@v1 + with: + command: start + instance-ids: i-01234567890abcdef0 + - name: SSH into EC2 instance + uses: aws-actions/ssh-action@v1 + with: + host: ${{ steps.start-ec2-instance.outputs.public-ip }} + username: ubuntu + key: ${{ secrets.SSH_PRIVATE_KEY }} + script: | + sudo yum install -y docker + sudo service docker start + sudo docker pull xmppjingle/banda:latest + sudo docker run --name banda -e REDIS_URL=${{ secrets.REDIS_URL }} -e AWS_ACCESS_KEY=${{ secrets.AWS_ACCESS_KEY }} -e AWS_SECRET_KEY=${{ secrets.AWS_SECRET_KEY }} -p 3000:3000 -d xmppjingle/banda:latest