Test deploy #14
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 Explorer | |
on: | |
push: | |
branches: [ "devops/55-nginx-reloading" ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: "recursive" | |
- name: Create Image Tarball for Explorer | |
run: | | |
mkdir -p artifacts/ | |
docker build --tag sportchain-explorer --file docker/Dockerfile . | |
docker save --output artifacts/sportchain-explorer.tar sportchain-explorer | |
- name: Set up SSH | |
run: | | |
mkdir -p ~/.ssh/ | |
touch ~/.ssh/known_hosts | |
ssh-keyscan ${{ secrets.EXPLORER_HOST }} >> ~/.ssh/known_hosts | |
echo "${{ secrets.EXPLORER_PRIVATE_KEY }}" > ~/.ssh/id_rsa | |
chmod 600 ~/.ssh/id_rsa | |
eval $(ssh-agent) | |
- name: Copy Files to Server | |
run: | | |
scp artifacts/sportchain-explorer.tar ${{ secrets.EXPLORER_USERNAME}}@${{ secrets.EXPLORER_HOST }}:/sportchain/ | |
scp docker/docker-compose.yml ${{ secrets.EXPLORER_USERNAME}}@${{ secrets.EXPLORER_HOST }}:/sportchain/docker-compose.yml | |
- name: SSH into Server and Deploy | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.EXPLORER_HOST }} | |
username: ${{ secrets.EXPLORER_USERNAME }} | |
key: ${{ secrets.EXPLORER_PRIVATE_KEY }} | |
script: | | |
cd /sportchain | |
docker load --input sportchain-explorer.tar | |
docker compose up --detach |