Use Two Pointer For Gain/Loss Calc #48
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 | |
on: | |
push: | |
branches: | |
- main | |
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 image | |
run: docker build -t trackme-builder . | |
- name: Extract binary from Docker container | |
run: | | |
docker create --name extract trackme-builder | |
docker cp extract:/app/trackme ./trackme | |
docker rm extract | |
- name: Copy assets and templates | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.SERVER_IP }} | |
username: ${{ secrets.SERVER_USER }} | |
key: ${{ secrets.SSH_PRIVATE_KEY }} | |
port: 22 | |
source: "trackme,web" | |
target: "~/track-me-temp/" | |
- name: Deploy to server | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.SERVER_IP }} | |
username: ${{ secrets.SERVER_USER }} | |
key: ${{ secrets.SSH_PRIVATE_KEY }} | |
port: 22 | |
script: | | |
~/track-me-temp/trackme --ping | |
if [ $? -eq 0 ]; then | |
echo "New binary test passed. Proceeding with deployment." | |
sudo systemctl stop trackme.service | |
mv ~/track-me-temp/trackme /root/track-me/trackme | |
rsync -av ~/track-me-temp/web/assets/* /root/track-me/web/assets | |
rsync -av ~/track-me-temp/web/templates/* /root/track-me/web/templates | |
sudo systemctl start trackme.service | |
else | |
echo "New binary test failed. Aborting deployment." | |
exit 1 | |
fi | |
rm -rf ~/track-me-temp/* |