diff --git a/deploy_user/Dockerfile b/deploy_user/Dockerfile new file mode 100644 index 0000000..1383ce3 --- /dev/null +++ b/deploy_user/Dockerfile @@ -0,0 +1,8 @@ +# Container image that runs your code +FROM node:22-bullseye + +# Copies your code file from your action repository to the filesystem path `/` of the container +COPY entrypoint.sh /entrypoint.sh + +# Code file to execute when the docker container starts up (`entrypoint.sh`) +ENTRYPOINT ["/entrypoint.sh"] diff --git a/deploy_user/action.yml b/deploy_user/action.yml index bbbe78e..d20a404 100644 --- a/deploy_user/action.yml +++ b/deploy_user/action.yml @@ -7,7 +7,7 @@ inputs: username: description: 'Pass in your skynet username' required: false - default: ${{ env.GITHUB_REPOSITORY_OWNER }} + default: "${{ github.GITHUB_REPOSITORY_OWNER }}" folder: description: 'Folder to upload, normally build' required: true @@ -16,23 +16,10 @@ inputs: required: false default: "" runs: - using: "composite" - steps: - - name: "Set SSH key" - shell: bash - run: | - # jank I know - echo "${{ inputs.ssh_key }}" > tmp.key - chmod 600 tmp.key - - name: "Ensure public_html exists" - shell: bash - run: | - ssh -v -i tmp.key ${{ inputs.username }}@skynet.skynet.ie "mkdir -p ~/public_html && chmod 711 ~ || true && chmod -R 755 ~/public_html || true" - - name: "Ensure destination exists" - shell: bash - run: | - ssh -v -i tmp.key ${{ inputs.username }}@skynet.skynet.ie "mkdir -p ~/public_html/${{ inputs.destination }}" - - name: "Copy files across" - shell: bash - run: | - scp -v -i tmp.key -r ${{ inputs.folder }}/* ${{ inputs.username }}@skynet.skynet.ie:/home/${{ inputs.username }}/public_html/${{ inputs.destination }} + using: 'docker' + image: 'Dockerfile' + args: + - ${{ inputs.username }} + - ${{ inputs.ssh_key }} + - ${{ inputs.folder }} + - ${{ github.destination }} \ No newline at end of file diff --git a/deploy_user/entrypoint.sh b/deploy_user/entrypoint.sh new file mode 100755 index 0000000..78db54c --- /dev/null +++ b/deploy_user/entrypoint.sh @@ -0,0 +1,23 @@ +#!/bin/sh + +export USERNAME=$1 +export SSH_KEY=$2 +export FOLDER=$3 +export DESTINATION=$4 + +echo $USERNAME +echo $FOLDER +echo $DESTINATION + +# jank I know +echo "$SSH_KEY" > tmp.key +chmod 600 tmp.key + +# ensure teh public_html is created and has right permissions +ssh -v -i tmp.key ${USERNAME}@skynet.skynet.ie "mkdir -p ~/public_html && chmod 711 ~ || true && chmod -R 755 ~/public_html || true" + +# ensure output folder exists +ssh -v -i tmp.key ${USERNAME}@skynet.skynet.ie "mkdir -p ~/public_html/${DESTINATION}" + +# copy files across +scp -v -i tmp.key -r ${FOLDER}/* ${USERNAME}@skynet.skynet.ie:/home/${USERNAME}/public_html/${DESTINATION} diff --git a/get_lfs/Dockerfile b/get_lfs/Dockerfile index 3a23611..695e421 100644 --- a/get_lfs/Dockerfile +++ b/get_lfs/Dockerfile @@ -1,5 +1,5 @@ # Container image that runs your code -FROM node:16-bullseye +FROM node:22-bullseye # make sure dependencies are installed RUN apt-get -y update