Update deploy.yml #34
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 Staging | |
on: | |
push: | |
branches: | |
- staging | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [22.x] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Set up SSH | |
env: | |
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} | |
SSH_PASSPHRASE: ${{ secrets.SSH_PASSPHRASE }} | |
KNOWN_HOSTS: ${{ secrets.KNOWN_HOSTS }} | |
run: | | |
mkdir -p ~/.ssh | |
echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa.pem # Use id_rsa.pem | |
chmod 600 ~/.ssh/id_rsa.pem # Adjust file permissions | |
eval $(ssh-agent -s) | |
echo "$SSH_PASSPHRASE" | ssh-add ~/.ssh/id_rsa.pem # Use id_rsa.pem with ssh-add | |
echo "$KNOWN_HOSTS" > ~/.ssh/known_hosts | |
ssh-add -l # List added keys for debugging | |
- name: Deploy to DigitalOcean Droplet | |
env: | |
DO_USERNAME: ${{ secrets.DO_USERNAME }} | |
DO_IP_ADDRESS: ${{ secrets.DO_IP_ADDRESS }} | |
run: | | |
ssh -v -T $DO_USERNAME@$DO_IP_ADDRESS << EOF | |
cd ~/bluewave-onboarding && git pull && docker compose down && docker compose build && docker compose up -d | |
EOF |