Deploy (manual) #51
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 (manual) | |
on: workflow_dispatch | |
jobs: | |
deploy-web-minusxapi-com: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up SSH | |
run: | | |
mkdir -p ~/.ssh | |
echo "${{ secrets.PROD_SERVER_SSH_KEY }}" > ~/.ssh/id_rsa | |
echo "${{ secrets.PROD_SERVER_SSH_PUB_KEY }}" > ~/.ssh/id_rsa.pub | |
chmod 600 ~/.ssh/id_rsa | |
chmod 600 ~/.ssh/id_rsa.pub | |
ssh-keyscan -H v1.minusxapi.com >> ~/.ssh/known_hosts | |
- name: Run frontend server (v1) | |
env: | |
REF: ${{ github.sha }} # ref to checkout | |
run: | | |
ssh [email protected] << EOF | |
set -e # Exit on any error | |
cd /home/minusx/minusx/web | |
git fetch --all --tags | |
git checkout $REF | |
git reset --hard $REF | |
docker compose up -d --build | |
docker image prune -f | |
EOF | |