ci: use private key #3
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 dev-m1sk9-s1 | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Tailscale | |
uses: tailscale/github-action@v2 | |
with: | |
oauth-client-id: ${{ secrets.TAILSCALE_OAUTH_CLIENT_ID }} | |
oauth-secret: ${{ secrets.TAILSCALE_OAUTH_SECRET }} | |
tags: tag:ci | |
- name: Deploy compose to dev-m1sk9-s1 | |
uses: appleboy/ssh-action@v1.1.0 | |
with: | |
host: ${{ secrets.SSH_HOST }} | |
username: ${{ secrets.SSH_USER }} | |
key: ${{ secrets.SSH_PRIVATE_KEY }} | |
port: ${{ secrets.SSH_PORT }} | |
script: | | |
cd compose | |
git pull origin main | |
find . -type f -name "compose.yaml" | while read -r compose_file; do | |
dir=$(dirname "$compose_file") | |
echo "Executing in directory: $dir" | |
(cd "$dir" && docker compose up -d --force-recreate --build) | |
if [ $? -eq 0 ]; then | |
echo "Success: $dir" | |
else | |
echo "Failed: $dir" | |
fi | |
done |