commit 995a69ebdcb84dfac66e3623648c2e312f8c803a Author: Annika Backstrom Date: Sat Apr 27 09:58:57 2024 +0100 Initial commit diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..2fcd6ce --- /dev/null +++ b/Dockerfile @@ -0,0 +1,8 @@ +# Container image that runs your code +FROM git.abackstrom.com/containers/deploy + +# 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/action.yml b/action.yml new file mode 100644 index 0000000..6c8e4a0 --- /dev/null +++ b/action.yml @@ -0,0 +1,17 @@ +# action.yml +name: 'Sixohthree Deploy' +description: 'Private deploy pipeline' +inputs: + local_path: + description: 'Local path' + required: false + default: './' + deploy_path: + description: 'Deploy path' + required: true +runs: + using: 'docker' + image: 'Dockerfile' + args: + - ${{ inputs.local_path }} + - ${{ inputs.deploy_path }} diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100755 index 0000000..dcc40aa --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,8 @@ +#!/bin/sh -l + +LOCAL_PATH="$1" +REMOTE_PATH="$2" + +echo rsync -hrz --delete -C --exclude=".*" -e ssh "$LOCAL_PATH" "deploy.sixohthree.com:/tmp/gitea_${GITEA_RUN_NUMBER}_${GITEA_SHA}" +echo ssh deploy.sixohthree.com "dsh -M -c -r ssh -g webs -- rsync -hvrz --delete -C -e ssh deploy.sixohthree.com:/tmp/gitea_${GITEA_RUN_NUMBER}_${GITEA_SHA}/ $REMOTE_PATH" +echo ssh deploy.sixohthree.com "rm -rf /tmp/gitea_${GITEA_RUN_NUMBER}_${GITEA_SHA}"