Updates
continuous-integration/drone/push Build was killed
Details
continuous-integration/drone/push Build was killed
Details
parent
2961c3daf4
commit
560cb5c81b
12
.drone.yml
12
.drone.yml
|
@ -14,7 +14,7 @@ steps:
|
||||||
dry_run: true
|
dry_run: true
|
||||||
password:
|
password:
|
||||||
from_secret: docker_password
|
from_secret: docker_password
|
||||||
repo: techknowlogick/drone-netlify
|
repo: internetmat/drone-netlify
|
||||||
tags: linux-amd64
|
tags: linux-amd64
|
||||||
username:
|
username:
|
||||||
from_secret: docker_username
|
from_secret: docker_username
|
||||||
|
@ -30,7 +30,7 @@ steps:
|
||||||
auto_tag_suffix: linux-amd64
|
auto_tag_suffix: linux-amd64
|
||||||
password:
|
password:
|
||||||
from_secret: docker_password
|
from_secret: docker_password
|
||||||
repo: techknowlogick/drone-netlify
|
repo: internetmat/drone-netlify
|
||||||
username:
|
username:
|
||||||
from_secret: docker_username
|
from_secret: docker_username
|
||||||
when:
|
when:
|
||||||
|
@ -59,7 +59,7 @@ steps:
|
||||||
dry_run: true
|
dry_run: true
|
||||||
password:
|
password:
|
||||||
from_secret: docker_password
|
from_secret: docker_password
|
||||||
repo: techknowlogick/drone-netlify
|
repo: internetmat/drone-netlify
|
||||||
tags: linux-arm64
|
tags: linux-arm64
|
||||||
username:
|
username:
|
||||||
from_secret: docker_username
|
from_secret: docker_username
|
||||||
|
@ -75,7 +75,7 @@ steps:
|
||||||
auto_tag_suffix: linux-arm64
|
auto_tag_suffix: linux-arm64
|
||||||
password:
|
password:
|
||||||
from_secret: docker_password
|
from_secret: docker_password
|
||||||
repo: techknowlogick/drone-netlify
|
repo: internetmat/drone-netlify
|
||||||
username:
|
username:
|
||||||
from_secret: docker_username
|
from_secret: docker_username
|
||||||
when:
|
when:
|
||||||
|
@ -104,7 +104,7 @@ steps:
|
||||||
dry_run: true
|
dry_run: true
|
||||||
password:
|
password:
|
||||||
from_secret: docker_password
|
from_secret: docker_password
|
||||||
repo: techknowlogick/drone-netlify
|
repo: internetmat/drone-netlify
|
||||||
tags: linux-arm
|
tags: linux-arm
|
||||||
username:
|
username:
|
||||||
from_secret: docker_username
|
from_secret: docker_username
|
||||||
|
@ -120,7 +120,7 @@ steps:
|
||||||
auto_tag_suffix: linux-arm
|
auto_tag_suffix: linux-arm
|
||||||
password:
|
password:
|
||||||
from_secret: docker_password
|
from_secret: docker_password
|
||||||
repo: techknowlogick/drone-netlify
|
repo: internetmat/drone-netlify
|
||||||
username:
|
username:
|
||||||
from_secret: docker_username
|
from_secret: docker_username
|
||||||
when:
|
when:
|
||||||
|
|
104
DOCS.md
104
DOCS.md
|
@ -1,104 +1,28 @@
|
||||||
---
|
---
|
||||||
date: 2018-02-15T00:00:00+00:00
|
date: 2018-02-15T00:00:00+00:00
|
||||||
title: Netlify
|
title: Netlify
|
||||||
author: lucaperret
|
author: internetmat
|
||||||
tags: [ deploy, netlify ]
|
tags: [ deploy, netlify ]
|
||||||
repo: lucaperret/drone-netlify
|
repo: internetmat/drone-netlify
|
||||||
logo: netlify.svg
|
logo: netlify.svg
|
||||||
image: lucap/drone-netlify
|
image: internetmat/drone-netlify
|
||||||
---
|
---
|
||||||
|
|
||||||
The netlify plugin deploy your build to [netlify.com](https://netlify.com).
|
The netlify plugin deploy your build to [netlify.com](https://netlify.com).
|
||||||
|
|
||||||
The below pipeline configuration demonstrates simple usage to deploy the current working directory:
|
The below pipeline configuration demonstrates the configuration for the plugin.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
pipeline:
|
pipeline:
|
||||||
netlify:
|
netlify:
|
||||||
image: lucap/drone-netlify
|
image: internetmat/drone-netlify
|
||||||
token: xxxxx
|
settings:
|
||||||
site_id: xxxxxxx-xxxx-xxx-xxxxxxxx
|
token:
|
||||||
|
from_secret: netlify_token
|
||||||
|
site:
|
||||||
|
from_secret: netlify_site_id
|
||||||
|
# override deploy alias, defaults to git SHA
|
||||||
|
alias: mybuild
|
||||||
|
path: /site/
|
||||||
|
prod: true
|
||||||
```
|
```
|
||||||
|
|
||||||
Example configuration for assigning [Netlify subdomain](https://www.netlify.com/docs/custom-domains/):
|
|
||||||
|
|
||||||
```diff
|
|
||||||
pipeline:
|
|
||||||
netlify:
|
|
||||||
image: lucap/drone-netlify
|
|
||||||
token: xxxxx
|
|
||||||
site_id: xxxxxxx-xxxx-xxx-xxxxxxxx
|
|
||||||
+ site_name: my-deployment-alias
|
|
||||||
```
|
|
||||||
|
|
||||||
Example configuration with [Custom domain](https://www.netlify.com/docs/custom-domains/):
|
|
||||||
|
|
||||||
```diff
|
|
||||||
pipeline:
|
|
||||||
netlify:
|
|
||||||
image: lucap/drone-netlify
|
|
||||||
token: xxxxx
|
|
||||||
site_id: xxxxxxx-xxxx-xxx-xxxxxxxx
|
|
||||||
- site_name: my-deployment-alias
|
|
||||||
+ domain: my-custom-domain.com
|
|
||||||
```
|
|
||||||
|
|
||||||
Example configuration for specifying [environment](https://www.netlify.com/docs/continuous-deployment/#deploy-contexts):
|
|
||||||
|
|
||||||
```diff
|
|
||||||
pipeline:
|
|
||||||
netlify:
|
|
||||||
image: lucap/drone-netlify
|
|
||||||
token: xxxxx
|
|
||||||
site_id: xxxxxxx-xxxx-xxx-xxxxxxxx
|
|
||||||
- domain: my-custom-domain.com
|
|
||||||
+ environment: production
|
|
||||||
```
|
|
||||||
|
|
||||||
Example configuration to deploy a specific folder or Zip (default current working directory):
|
|
||||||
|
|
||||||
```diff
|
|
||||||
pipeline:
|
|
||||||
netlify:
|
|
||||||
image: lucap/drone-netlify
|
|
||||||
token: xxxxx
|
|
||||||
site_id: xxxxxxx-xxxx-xxx-xxxxxxxx
|
|
||||||
- environment: production
|
|
||||||
+ path: ./dist
|
|
||||||
```
|
|
||||||
|
|
||||||
Example configuration using token from secrets:
|
|
||||||
|
|
||||||
```diff
|
|
||||||
pipeline:
|
|
||||||
netlify:
|
|
||||||
image: lucap/drone-netlify
|
|
||||||
- token: xxxxx
|
|
||||||
site_id: xxxxxxx-xxxx-xxx-xxxxxxxx
|
|
||||||
+ secrets: [ netlify_token ]
|
|
||||||
```
|
|
||||||
|
|
||||||
# Secret Reference
|
|
||||||
|
|
||||||
netlify_token
|
|
||||||
: Netlify [token](https://app.netlify.com/applications)
|
|
||||||
|
|
||||||
# Parameter Reference
|
|
||||||
|
|
||||||
token
|
|
||||||
: `Required` Netlify [token](https://app.netlify.com/applications)
|
|
||||||
|
|
||||||
site_id
|
|
||||||
: `Required` Set the Site ID (or API ID in your Site settings dashboard)
|
|
||||||
|
|
||||||
site_name
|
|
||||||
: Set a Netlify subdomain
|
|
||||||
|
|
||||||
domain
|
|
||||||
: Set your custom domain
|
|
||||||
|
|
||||||
environment
|
|
||||||
: Specify an environment
|
|
||||||
|
|
||||||
path
|
|
||||||
: Path to a folder or zip file to deploy
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
FROM node:16-slim
|
FROM node:19-slim
|
||||||
|
|
||||||
LABEL maintainer="techknowlogick <techknowlogick@gitea.io>"
|
LABEL maintainer="internetmat <mat@mat.services>"
|
||||||
LABEL org.label-schema.description="Deploying to netlify with Drone CI"
|
LABEL org.label-schema.description="Deploying to netlify with Drone CI"
|
||||||
|
|
||||||
RUN npm install -g netlify-cli
|
RUN npm install -g netlify-cli
|
||||||
|
|
19
README.md
19
README.md
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
> Deploying to [Netlify](https://netlify.com) with [Drone](https://drone.io) CI.
|
> Deploying to [Netlify](https://netlify.com) with [Drone](https://drone.io) CI.
|
||||||
|
|
||||||
[![Docker Pulls](https://img.shields.io/docker/pulls/techknowlogick/drone-netlify.svg)](https://hub.docker.com/r/techknowlogick/drone-netlify/)
|
[![Docker Pulls](https://img.shields.io/docker/pulls/internetmat/drone-netlify.svg)](https://hub.docker.com/r/internetmat/drone-netlify/)
|
||||||
|
|
||||||
Use case examples:
|
Use case examples:
|
||||||
|
|
||||||
|
@ -23,12 +23,11 @@ Deploy the working directory to Netlify.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker run --rm \
|
docker run --rm \
|
||||||
-e PLUGIN_TOKEN=xxxxx \
|
-e PLUGIN_TOKEN=$NETLIFY_TOKEN \
|
||||||
-e PLUGIN_SITE_ID=xxxxxxx-xxxx-xxx-xxxxxxxx \
|
-e PLUGIN_SITE=my-netlify-site \
|
||||||
-e PLUGIN_SITE_NAME=netlify-subdomain
|
|
||||||
-v $(pwd):$(pwd) \
|
-v $(pwd):$(pwd) \
|
||||||
-w $(pwd) \
|
-w $(pwd) \
|
||||||
lucap/drone-netlify
|
internetmat/drone-netlify
|
||||||
```
|
```
|
||||||
|
|
||||||
### From Drone CI
|
### From Drone CI
|
||||||
|
@ -36,8 +35,10 @@ docker run --rm \
|
||||||
```yaml
|
```yaml
|
||||||
pipeline:
|
pipeline:
|
||||||
netlify:
|
netlify:
|
||||||
image: techknowlogick/drone-netlify
|
image: internetmat/drone-netlify
|
||||||
token: xxxxx
|
settings:
|
||||||
site_id: xxxxxxx-xxxx-xxx-xxxxxxxx
|
token:
|
||||||
site_name: netlify-subdomain
|
from_secret: netlify_token
|
||||||
|
site:
|
||||||
|
from_secret: netlify_site_id
|
||||||
```
|
```
|
||||||
|
|
47
script.sh
47
script.sh
|
@ -3,19 +3,17 @@ set -e
|
||||||
|
|
||||||
NETLIFY_SITE=""
|
NETLIFY_SITE=""
|
||||||
NETLIFY_DEPLOY_OPTIONS=""
|
NETLIFY_DEPLOY_OPTIONS=""
|
||||||
NETLIFY_UPDATE_OPTIONS=""
|
|
||||||
|
|
||||||
if [ -n "$PLUGIN_ENVIRONMENT" ]
|
if [ -n "$PLUGIN_PROD" ] && [ "$PLUGIN_PROD" != false ]
|
||||||
then
|
then
|
||||||
NETLIFY_DEPLOY_OPTIONS="-e ${PLUGIN_ENVIRONMENT}"
|
NETLIFY_DEPLOY_OPTIONS="--prod"
|
||||||
NETLIFY_UPDATE_OPTIONS="${NETLIFY_DEPLOY_OPTIONS}"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$PLUGIN_PATH" ]
|
if [ -n "$PLUGIN_PATH" ]
|
||||||
then
|
then
|
||||||
NETLIFY_DEPLOY_OPTIONS="${NETLIFY_DEPLOY_OPTIONS} -d ${PLUGIN_PATH}"
|
NETLIFY_DEPLOY_OPTIONS="${NETLIFY_DEPLOY_OPTIONS} --dir ${PLUGIN_PATH}"
|
||||||
else
|
else
|
||||||
NETLIFY_DEPLOY_OPTIONS="${NETLIFY_DEPLOY_OPTIONS} -d ./"
|
NETLIFY_DEPLOY_OPTIONS="${NETLIFY_DEPLOY_OPTIONS} --dir ./"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$PLUGIN_TOKEN" ]
|
if [ -z "$PLUGIN_TOKEN" ]
|
||||||
|
@ -29,32 +27,29 @@ then
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$PLUGIN_SITE_ID" ] && [ -n "$PLUGIN_TOKEN" ]
|
if [ -n "$PLUGIN_ALIAS" ]
|
||||||
then
|
then
|
||||||
NETLIFY_SITE="--prod -a $PLUGIN_TOKEN -s $PLUGIN_SITE_ID"
|
NETLIFY_DEPLOY_OPTIONS="${NETLIFY_DEPLOY_OPTIONS} --alias ${PLUGIN_ALIAS}"
|
||||||
|
elif [ -n "$DRONE_COMMIT_SHA" ]
|
||||||
|
then
|
||||||
|
NETLIFY_DEPLOY_OPTIONS="${NETLIFY_DEPLOY_OPTIONS} --alias ${DRONE_COMMIT_SHA}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
message="Automated deploy from build.mat.services
|
||||||
|
(${DRONE_COMMIT_BRANCH} @ ${DRONE_COMMIT_SHA})
|
||||||
|
$DRONE_COMMIT_MESSAGE"
|
||||||
|
NETLIFY_DEPLOY_OPTIONS="${NETLIFY_DEPLOY_OPTIONS} --message '$message'"
|
||||||
|
|
||||||
|
if [ -n "$PLUGIN_SITE" ]
|
||||||
|
then
|
||||||
|
NETLIFY_SITE="--auth $PLUGIN_TOKEN --site $PLUGIN_SITE"
|
||||||
echo "> Deploying on Netlify…" &&
|
echo "> Deploying on Netlify…" &&
|
||||||
netlify deploy $NETLIFY_SITE $NETLIFY_DEPLOY_OPTIONS;
|
netlify deploy "$NETLIFY_SITE" "$NETLIFY_DEPLOY_OPTIONS";
|
||||||
else
|
else
|
||||||
echo "> Error! site_id and token are required"
|
echo "> Error! site (site ID or name) and token are required"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$PLUGIN_SITE_NAME" ]
|
|
||||||
then
|
|
||||||
NETLIFY_UPDATE_OPTIONS="${NETLIFY_UPDATE_OPTIONS} -n ${PLUGIN_SITE_NAME}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -n "$PLUGIN_DOMAIN" ]
|
|
||||||
then
|
|
||||||
NETLIFY_UPDATE_OPTIONS="${NETLIFY_UPDATE_OPTIONS} -d ${PLUGIN_DOMAIN}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -n "$PLUGIN_SITE_NAME" ] || [ -n "$PLUGIN_DOMAIN" ]
|
|
||||||
then
|
|
||||||
echo "> Updating your Netlify site…" &&
|
|
||||||
netlify $NETLIFY_SITE update $NETLIFY_UPDATE_OPTIONS;
|
|
||||||
fi
|
|
||||||
|
|
||||||
rc=$?;
|
rc=$?;
|
||||||
if [[ $rc != 0 ]]
|
if [[ $rc != 0 ]]
|
||||||
then
|
then
|
||||||
|
|
Loading…
Reference in New Issue