I've a staging server on DO.
I want to build & deploy my node app to it.
name: Build & Deploy
on:
push:
tags:
- 'v1.*.0'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Create SSH key
run: |
mkdir -p ~/.ssh/
echo "$DO_GITHUB_PRIVATE_KEY" > ../github_do.key
sudo chmod 600 ../github_do.key
ssh-keyscan -H ${{secrets.DEPLOY_SERVER}} > ~/.ssh/known_hosts
shell: bash
env:
DO_GITHUB_PRIVATE_KEY: ${{secrets.DO_GITHUB_PRIVATE_KEY}}
- uses: actions/setup-node@v1
with:
node-version: 12.x
- name: Install Packages
run: yarn install --frozen-lockfile
- name: Build artifacts
env:
DEPLOY_SSH_KEY_PATH: ${{ github.workspace }}/../github_do.key
run: |
yarn shipit production fast-deploy
What i've done is to generate a new SSH private & public keys.
The private key I've saved inside DO_GITHUB_PRIVATE_KEY github secret.
The public key I've added to authorized_keys on my staging server.
When the action is triggered, it fails on:
@ v***.256.0
Create release path "/home/***/***/releases/2020-03-0***-v***.256.0"
Running "mkdir -p /home/***/***/releases/2020-03-0***-v***.256.0" on host "***".
@***-err ***@***: Permission denied (publickey,gssapi-keyex,gssapi-with-mic).
'fast-deploy:updateRemote' errored after ***.32 s
Error: Command failed: ssh -i /home/runner/work/***/***/../github_do.key ***@*** "mkdir -p /home/***/***/releases/2020-03-0***-v***.256.0"