Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions .github/workflows/deploy.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/bin/bash
set -e

# Create SSH key file with proper handling
echo "$SSH_KEY" > key.pem
# Create SSH key file with proper handling, stripping Windows-style line endings
printf '%s' "$SSH_KEY" | tr -d '\r' > key.pem
chmod 600 key.pem

# Verify key file was created properly
Expand All @@ -17,6 +17,8 @@ echo "Deploying to $SSH_USER@$SSH_HOST..."
scp -o StrictHostKeyChecking=no \
-o UserKnownHostsFile=/dev/null \
-o ConnectTimeout=10 \
-o BatchMode=yes \
-o PasswordAuthentication=no \
-i key.pem \
unchain unchain.service \
"${SSH_USER}@${SSH_HOST}:~"
Expand All @@ -25,6 +27,8 @@ scp -o StrictHostKeyChecking=no \
ssh -o StrictHostKeyChecking=no \
-o UserKnownHostsFile=/dev/null \
-o ConnectTimeout=10 \
-o BatchMode=yes \
-o PasswordAuthentication=no \
-i key.pem \
"${SSH_USER}@${SSH_HOST}" << 'SSHEOF'
set -e
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,13 @@ jobs:
GIT_REPO: ${{ github.repository }}
run: |
echo "Building Go application with gitHash=${{ env.gitHash }} and buildTime=${{ env.buildTime }}"
go build -ldflags="-X 'main.gitHash=${{ github.sha }}' -X 'main.buildTime=${{ env.buildTime }}'" -o unchain .ldTime=${{ env.buildTime }}'" -o unchain .
go build -ldflags="-X 'main.gitHash=${{ github.sha }}' -X 'main.buildTime=${{ env.buildTime }}'" -o unchain .
Comment thread
mojocn marked this conversation as resolved.

- name: Deploy to AliCould ECS
- name: Deploy to AliCloud ECS
env:
SSH_HOST: ${{ secrets.ECS_HOST }}
SSH_USER: ${{ secrets.ECS_USER }}
SSH_KEY: ${{ secrets.ECS_KEY }}
CONFIG_TOML: ${{ vars.CONFIG_TOML }}
run: bash .github/workflows/deploy.sh
# add more server to deploy

Loading