Test new release of mongodb workflow. #3
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: Release Prod Docker image to Linode | |
# on: | |
# release: | |
# types: [published] | |
on: | |
push: | |
branches-ignore: | |
- 'master' | |
jobs: | |
deploy_to_linode: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v4 | |
- name: Copy docker-compose.yml to Linode | |
uses: appleboy/scp-action@master | |
with: | |
host: ${{ secrets.REMOTE_HOST }} | |
username: ${{ secrets.REMOTE_USERNAME }} | |
password: ${{ secrets.REMOTE_PASSWORD }} | |
port: ${{ secrets.REMOTE_PORT }} | |
source: './docker-compose.yml' | |
target: '/root/docker-compose-mongo/' | |
- name: Execute remote Docker Compose command | |
uses: appleboy/ssh-action@v1.0.3 | |
env: | |
MONGO_INITDB_ROOT_USERNAME: 'admin' | |
MONGO_INITDB_ROOT_PASSWORD: ${{ secrets.MONGO_INITDB_ROOT_PASSWORD }} | |
DOCKER_EXPOSE_PORT: 27017 | |
with: | |
host: ${{ secrets.REMOTE_HOST }} | |
username: ${{ secrets.REMOTE_USERNAME }} | |
password: ${{ secrets.REMOTE_PASSWORD }} | |
port: ${{ secrets.REMOTE_PORT }} | |
envs: MONGO_INITDB_ROOT_USERNAME,MONGO_INITDB_ROOT_PASSWORD,DOCKER_EXPOSE_PORT | |
script: | | |
cd /root/docker-compose-mongo/ | |
docker compose -f docker-compose.yml pull | |
docker compose -f docker-compose.yml down | |
docker compose -f docker-compose.yml --project-name derecks_mongodb-prod down | |
docker container prune -f | |
docker system prune -af | |
docker compose -f docker-compose.yml up -d |