diff --git a/README.md b/README.md index 7d45707..5d56ad7 100644 --- a/README.md +++ b/README.md @@ -44,6 +44,11 @@ hint: See the 'Note about fast-forwards' in 'git push --help' for details. Port for ssh host. If not specified, `22` will be used. +### commit + +Commit to deploy. If not specified, `$GITHUB_SHA` (current commit) will be used. + + ## Example Note: `actions/checkout` must preceed this action in order for the repository data to be exposed for the action. diff --git a/action.yml b/action.yml index 1e50666..37d7412 100644 --- a/action.yml +++ b/action.yml @@ -30,6 +30,10 @@ inputs: description: "Custom port for ssh host" required: false default: "22" + commit: + description: "Commit to push to dokku. Defaults to $GITHUB_SHA" + required: false + default: "" runs: using: "docker" image: "Dockerfile" @@ -41,3 +45,4 @@ runs: - ${{ inputs.remote-branch }} - ${{ inputs.git-push-flags }} - ${{ inputs.ssh-port }} + - ${{ inputs.commit }} diff --git a/entrypoint.sh b/entrypoint.sh index fe17afc..23fe73c 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -7,6 +7,7 @@ DOKKU_APP_NAME=$4 DOKKU_REMOTE_BRANCH=$5 GIT_PUSH_FLAGS=$6 SSH_PORT=$7 +COMMIT="${8:-$GITHUB_SHA}" # Setup the SSH environment mkdir -p ~/.ssh @@ -20,7 +21,7 @@ cd "$GITHUB_WORKSPACE" git remote add deploy "$git_repo" # Prepare to push to Dokku git repository -REMOTE_REF="$GITHUB_SHA:refs/heads/$DOKKU_REMOTE_BRANCH" +REMOTE_REF="$COMMIT:refs/heads/$DOKKU_REMOTE_BRANCH" GIT_COMMAND="git push deploy $REMOTE_REF $GIT_PUSH_FLAGS" echo "GIT_COMMAND=$GIT_COMMAND"