fix paths

main
Dragan Filipovic 2022-12-30 10:29:20 +01:00
parent a3412294d1
commit d334a45df7
2 changed files with 19 additions and 12 deletions

View File

@ -6,7 +6,6 @@ on:
- feature/add-tests - feature/add-tests
env: env:
TEST_PROJECT: ./test_project
TEST_HOST_DOCKER: ./test TEST_HOST_DOCKER: ./test
TEST_USER: kaja TEST_USER: kaja
@ -18,16 +17,23 @@ jobs:
- name: Checkout - name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: Clean up old test files
run: |
docker stop ssh-host-container || true && docker rm ssh-host-container || true
- name: 1. Create ssh keys - name: 1. Create ssh keys
run: | run: |
echo $HOME
ls -la $HOME
ssh-keygen -m PEM -t rsa -b 4096 -f "$HOME/.ssh/id_rsa" -N "" ssh-keygen -m PEM -t rsa -b 4096 -f "$HOME/.ssh/id_rsa" -N ""
EXAMPLE_SSH_PRIVATE_KEY=$(cat $HOME/.ssh/id_rsa) # ssh-add "$HOME/.ssh/id_rsa"
echo "EXAMPLE_SSH_PRIVATE_KEY=$EXAMPLE_SSH_PRIVATE_KEY<<EOF" >> $GITHUB_ENV # ssh-add -l
ssh-add "$HOME/.ssh/id_rsa" echo "EXAMPLE_SSH_PRIVATE_KEY<<EOF" >> $GITHUB_ENV
ssh-add -l cat $HOME/.ssh/id_rsa >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
- name: Build Host Server Image - name: Build Host Server Image
working-directory: $TEST_HOST_DOCKER working-directory: ${{ env.TEST_HOST_DOCKER }}
run: | run: |
docker build \ docker build \
-t ssh-host-image . \ -t ssh-host-image . \
@ -35,7 +41,7 @@ jobs:
--build-arg ssh_user=$TEST_USER \ --build-arg ssh_user=$TEST_USER \
- name: Start Host Server Container - name: Start Host Server Container
working-directory: $TEST_HOST_DOCKER working-directory: ${{ env.TEST_HOST_DOCKER }}
run: | run: |
docker run --name ssh-host-container -d ssh-host-image docker run --name ssh-host-container -d ssh-host-image
@ -48,7 +54,8 @@ jobs:
- name: Create project file - name: Create project file
run: | run: |
mkdir $TEST_PROJECT && cd $TEST_PROJECT mkdir test_project
cd test_project
touch index.html touch index.html
date +"%Y-%m-%d %H:%M:%S,%3N" >> index.html date +"%Y-%m-%d %H:%M:%S,%3N" >> index.html
cat index.html cat index.html
@ -56,10 +63,10 @@ jobs:
- name: e2e Test ssh-deploy action - name: e2e Test ssh-deploy action
uses: easingthemes/ssh-deploy@main uses: easingthemes/ssh-deploy@main
env: env:
SSH_PRIVATE_KEY: $EXAMPLE_SSH_PRIVATE_KEY SSH_PRIVATE_KEY: env.EXAMPLE_SSH_PRIVATE_KEY
ARGS: "-rltgoDzvO" ARGS: "-rltgoDzvO"
SOURCE: "dist/" SOURCE: "test_project/"
REMOTE_HOST: $EXAMPLE_REMOTE_HOST REMOTE_HOST: env.EXAMPLE_REMOTE_HOST
REMOTE_USER: $TEST_USER REMOTE_USER: $TEST_USER
TARGET: "/var/www/html/" TARGET: "/var/www/html/"
EXCLUDE: "/dist/, /node_modules/" EXCLUDE: "/dist/, /node_modules/"

View File

@ -3,7 +3,7 @@ FROM nginx
ARG ssh_pub_key ARG ssh_pub_key
ARG ssh_user ARG ssh_user
# Add a user to the container # Add a user to the container
RUN adduser -D $ssh_user RUN adduser --disabled-password $ssh_user
USER $ssh_user USER $ssh_user
# Add the ssh public key to the container # Add the ssh public key to the container
RUN mkdir -p $HOME/.ssh RUN mkdir -p $HOME/.ssh