commit d83864234eb70bfc4cb0cfb405a3b881e610f485 Author: Simon Bruder Date: Tue Aug 4 00:47:49 2020 +0200 Init diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..2d51729 --- /dev/null +++ b/.drone.yml @@ -0,0 +1,13 @@ +kind: pipeline +name: default + +steps: +- name: docker + image: plugins/docker + settings: + registry: r.sbruder.de + username: + from_secret: docker_username + password: + from_secret: docker_password + repo: r.sbruder.de/drone-netlify diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..d152c08 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,9 @@ +FROM node:alpine + +RUN apk add --no-cache git + +RUN yarn global add netlify-cli + +COPY entrypoint.sh / + +ENTRYPOINT ["/entrypoint.sh"] diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100755 index 0000000..a79b908 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,25 @@ +#!/bin/sh +set -e + +if ! [ -e ".netlify/state.json" ]; then + echo "“.netlify/state.json” is missing, create it in your repository with “netlify deploy”" + exit 1 +fi + +if [ -z "$PLUGIN_DIR" ]; then + echo "Please specify “dir”" + exit 1 +fi + +if [ -z "$PLUGIN_AUTH_TOKEN" ]; then + echo "Please specify “auth_token”" + exit 1 +fi + +netlify deploy -a "$PLUGIN_AUTH_TOKEN" -d "$PLUGIN_DIR" -m "$(git log -1 --pretty=%B)" $( + if [ -n "$PLUGIN_PROD" ]; then + echo "-p" + else + echo "--alias $(git log -1 --pretty=%H)" + fi +)