diff --git a/.github/workflows/ssh-server.yml b/.github/workflows/ssh-server.yml index c410658..98bbd69 100644 --- a/.github/workflows/ssh-server.yml +++ b/.github/workflows/ssh-server.yml @@ -45,13 +45,28 @@ jobs: - name: Checkout code uses: actions/checkout@v4 + - name: add public key to env + run: | + echo "PUBLIC_KEY<> $GITHUB_ENV + cat testdata/.ssh/id_rsa.pub >> $GITHUB_ENV + echo "EOF" >> $GITHUB_ENV + echo "======= public key =========" + cat testdata/.ssh/id_rsa.pub + echo "============================" + echo "PRIVATE_KEY<> $GITHUB_ENV + cat testdata/.ssh/id_rsa >> $GITHUB_ENV + echo "EOF" >> $GITHUB_ENV + echo "======= private key =========" + cat testdata/.ssh/id_rsa + echo "============================" + - name: create new ssh server run: | docker run -d \ --name=openssh-server \ --hostname=openssh-server \ -p 2223:2222 \ - -e PUBLIC_KEY=$(cat testdata/.ssh/id_rsa.pub) \ + -e PUBLIC_KEY="${{ env.PUBLIC_KEY }}" \ -e SUDO_ACCESS=false \ -e PASSWORD_ACCESS=true \ -e USER_PASSWORD=password \ @@ -62,9 +77,6 @@ jobs: echo "REMOTE_HOST<> $GITHUB_ENV cat ip.txt >> $GITHUB_ENV echo "EOF" >> $GITHUB_ENV - echo "PRIVATE_KEY<> $GITHUB_ENV - cat testdata/.ssh/id_rsa >> $GITHUB_ENV - echo "EOF" >> $GITHUB_ENV echo "======= container ip address =========" cat ip.txt echo "======================================"