teste ssh private key #4
Workflow file for this run
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
name: Deploy to DigitalOcean | |
on: | |
push: | |
branches: | |
- setup/digital-ocean | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Build Docker images | |
run: docker-compose build | |
- name: Set up SSH | |
uses: webfactory/ssh-agent@v0.5.3 | |
with: | |
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} | |
run: | |
echo SSH_PRIVATE_KEY - ${{ secrets.SSH_PRIVATE_KEY }} | |
- name: Save and transfer API image to DigitalOcean | |
run: | | |
IMAGE_API_ID=$(docker images -q abibliadigital_api:latest) | |
docker save $IMAGE_API_ID | bzip2 | ssh root@${{ secrets.DROPLET_IP }} 'bunzip2 | docker load' | |
- name: Save and transfer Mongo image to DigitalOcean | |
run: | | |
IMAGE_MONGO_ID=$(docker images -q abibliadigital_mongo:latest) | |
docker save $IMAGE_MONGO_ID | bzip2 | ssh root@${{ secrets.DROPLET_IP }} 'bunzip2 | docker load' | |
- name: Deploy to DigitalOcean | |
run: | | |
ssh root@${{ secrets.DROPLET_IP }} "docker-compose -f /path/to/docker-compose.yml up -d" |