Refactor SSH key handling in deployment workflow for improved clarity and efficiency
Some checks failed
/ print-content (push) Failing after 3s

This commit is contained in:
암냥 2026-05-31 14:05:37 +09:00
commit c7f7fdecbf
No known key found for this signature in database

View file

@ -7,36 +7,25 @@ jobs:
run: uname -a
- name: checkout code
uses: actions/checkout@v4
- name: ssh-add
run: |
source /etc/bashrc
nix shell nixpkgs#openssh
- name: Setup SSH Key
run: |
echo "${{ secrets.SSH_KEY }}" > ssh_key
chmod 600 ssh_key
eval "$(ssh-agent -s)"
ssh-add ssh_key
- name: Build
run: |
source /etc/bashrc
nix shell nixpkgs#bun
bun i
bun run build
nix shell nixpkgs#bun --run "bun i && bun run build"
- name: Deploy
run: |
source /etc/bashrc
# rsync의 ssh 옵션에 -i ssh_key를 직접 지정
nix shell nixpkgs#rsync nixpkgs#openssh --run \
"rsync -avz --delete -e 'ssh -i ssh_key -o StrictHostKeyChecking=no' dist/* imnyang@10.11.8.101:/var/static/imnya.ng/."
nix shell nixpkgs#rsync nixpkgs#openssh
rsync -avz --delete -e "ssh -o StrictHostKeyChecking=no" dist/* imnyang@10.11.8.101:/var/static/imnya.ng/.
- name: Cleanup
if: always()
run: |
source /etc/bashrc
nix shell nixpkgs#openssh
ssh-add -D ssh_key
rm ssh_key
rm -f ssh_key