Compare commits

...

33 Commits
v0.1.2 ... main

Author SHA1 Message Date
mat ess c5513a13c3 Revert "Remove --site option"
continuous-integration/drone/push Build is passing Details
This reverts commit 045f85cd2b.
2022-12-04 20:07:38 -05:00
mat ess 045f85cd2b Remove --site option
continuous-integration/drone/push Build is passing Details
2022-12-04 17:43:09 -05:00
mat ess 0b0dfa9f44 Add debug option
continuous-integration/drone/push Build is passing Details
2022-10-21 00:51:58 -04:00
mat ess 56a6269975 Add rework debug
continuous-integration/drone/push Build is passing Details
2022-10-21 00:09:45 -04:00
mat ess 4118f27548 Add force_tag
continuous-integration/drone/push Build is passing Details
2022-10-21 00:03:13 -04:00
mat ess d28e4a08bf Simplify drone.yml
continuous-integration/drone/push Build is passing Details
2022-10-20 23:55:11 -04:00
mat ess 6e0039f4ac Try another thing
continuous-integration/drone Build is passing Details
continuous-integration/drone/push Build is passing Details
2022-10-20 23:32:54 -04:00
mat ess 2d42dc1c3a Add debug 2.2-electric_boogaloo
continuous-integration/drone/push Build is passing Details
2022-10-20 23:15:12 -04:00
mat ess f6a9f0128c Add debug 2.2
continuous-integration/drone/push Build is passing Details
2022-10-20 23:03:04 -04:00
mat ess 9a6c3ac24a Add debug 2
continuous-integration/drone/push Build is passing Details
2022-10-20 22:59:45 -04:00
mat ess 809c5f10f2 Add debug
continuous-integration/drone/push Build is passing Details
2022-10-20 22:55:42 -04:00
mat ess 0543638553 Fix drone commit message passing
continuous-integration/drone/push Build is passing Details
2022-10-20 20:19:26 -04:00
mat ess b20baf7ec6 Use drone commit message
continuous-integration/drone/push Build is passing Details
2022-10-20 19:51:01 -04:00
mat ess f4179ef114 Fix script
continuous-integration/drone/push Build is passing Details
2022-10-20 18:47:15 -04:00
mat ess 0a94ba4862 Support only amd64 for now
continuous-integration/drone/push Build is passing Details
2022-10-20 18:05:25 -04:00
mat ess 560cb5c81b Updates
continuous-integration/drone/push Build was killed Details
2022-10-20 17:58:05 -04:00
techknowlogick 2961c3daf4
Update Dockerfile 2021-06-03 20:52:05 -04:00
techknowlogick 9e15effeb3
support renaming of primary git branch 2021-06-03 19:32:22 -04:00
techknowlogick b1d2c2703c
Update README.md 2021-06-03 19:31:36 -04:00
techknowlogick 492fa7135e
trigger rebuild 2021-06-03 19:31:10 -04:00
techknowlogick 42903beb0d
Update script.sh 2020-11-19 22:46:29 -05:00
techknowlogick 3c3eac0834
Update Dockerfile 2020-11-19 22:46:15 -05:00
techknowlogick 5f17cccafe
Merge pull request #2 from khmarbaise/fixed
Fixed issue with "[[: not found" message during execution.
2020-11-19 17:53:28 -05:00
Karl Heinz Marbaise 75b308a52a
Fixed issue with "[[: not found" message during execution. 2020-11-19 23:50:47 +01:00
techknowlogick d585bba334
assume prod 2020-01-28 20:10:17 -05:00
techknowlogick c9ada3a8ee
path flag 2020-01-28 20:03:33 -05:00
techknowlogick b14f2c6578
Merge pull request #1 from jolheiser/master
Update CLI
2020-01-28 19:46:02 -05:00
jolheiser f30bcff0cf
Revert other change
Signed-off-by: jolheiser <john.olheiser@gmail.com>
2020-01-28 09:12:42 -06:00
jolheiser ef10f9b285
Update CLI
Signed-off-by: jolheiser <john.olheiser@gmail.com>
2020-01-28 09:09:54 -06:00
techknowlogick c02be20586
simplify labels
as drone adds most of them already automatically
2020-01-14 22:16:14 -05:00
techknowlogick c697d4d5fa
slim down container 2020-01-14 21:50:42 -05:00
techknowlogick 9e4aa61975
attempt without alpine (due to uid/gid issues) 2020-01-14 21:47:36 -05:00
Matti R 12e8026aa3
support arm platforms 2020-01-14 21:39:12 -05:00
6 changed files with 108 additions and 146 deletions

View File

@ -1,8 +1,42 @@
pipeline:
docker:
image: plugins/docker
secrets: [ docker_username, docker_password ]
repo: lucap/drone-netlify
auto_tag: true
when:
event: tag
kind: pipeline
name: linux-amd64
platform:
os: linux
arch: amd64
steps:
- name: dryrun
pull: always
image: plugins/docker:linux-amd64
settings:
repo: internetmat/drone-netlify
tags: latest
dry_run: true
password:
from_secret: docker_password
username:
from_secret: docker_username
when:
event:
- pull_request
- name: publish
pull: always
image: plugins/docker:linux-amd64
settings:
repo: internetmat/drone-netlify
tags: latest
force_tag: true
password:
from_secret: docker_password
username:
from_secret: docker_username
when:
event:
- push
- tag
trigger:
branch:
- main

104
DOCS.md
View File

@ -1,104 +1,28 @@
---
date: 2018-02-15T00:00:00+00:00
title: Netlify
author: lucaperret
author: internetmat
tags: [ deploy, netlify ]
repo: lucaperret/drone-netlify
repo: internetmat/drone-netlify
logo: netlify.svg
image: lucap/drone-netlify
image: internetmat/drone-netlify
---
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
pipeline:
netlify:
image: lucap/drone-netlify
token: xxxxx
site_id: xxxxxxx-xxxx-xxx-xxxxxxxx
image: internetmat/drone-netlify
settings:
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

View File

@ -1,12 +1,7 @@
FROM node:alpine
FROM node:19-slim
LABEL maintainer="Luca Perret <perret.luca@gmail.com>"
LABEL org.label-schema.version=latest
LABEL org.label-schema.vcs-url="https://github.com/lucaperret/drone-netlify"
LABEL org.label-schema.name="drone-netlify"
LABEL maintainer="internetmat <mat@mat.services>"
LABEL org.label-schema.description="Deploying to netlify with Drone CI"
LABEL org.label-schema.vendor="Luca Perret"
LABEL org.label-schema.schema-version="1.0"
RUN npm install -g netlify-cli

View File

@ -1,12 +1,10 @@
# Drone-netlify
# drone-netlify
![Netlify logo](netlify.png?raw=true "netlify.com")
> Deploying to [Netlify](https://netlify.com) with [Drone](https://drone.io) CI.
[![Docker Pulls](https://img.shields.io/docker/pulls/lucap/drone-netlify.svg)](https://hub.docker.com/r/lucap/drone-netlify/)
[![Image](https://images.microbadger.com/badges/image/lucap/drone-netlify.svg)](https://microbadger.com/images/lucap/drone-netlify "Get your own image badge on microbadger.com")
[![GitHub release](https://img.shields.io/github/release/lucaperret/drone-netlify.svg)](https://github.com/lucaperret/drone-netlify/releases/latest)
[![Docker Pulls](https://img.shields.io/docker/pulls/internetmat/drone-netlify.svg)](https://hub.docker.com/r/internetmat/drone-netlify/)
Use case examples:
@ -25,12 +23,11 @@ Deploy the working directory to Netlify.
```bash
docker run --rm \
-e PLUGIN_TOKEN=xxxxx \
-e PLUGIN_SITE_ID=xxxxxxx-xxxx-xxx-xxxxxxxx \
-e PLUGIN_SITE_NAME=netlify-subdomain
-e PLUGIN_TOKEN=$NETLIFY_TOKEN \
-e PLUGIN_SITE=my-netlify-site \
-v $(pwd):$(pwd) \
-w $(pwd) \
lucap/drone-netlify
internetmat/drone-netlify
```
### From Drone CI
@ -38,8 +35,10 @@ docker run --rm \
```yaml
pipeline:
netlify:
image: lucap/drone-netlify
token: xxxxx
site_id: xxxxxxx-xxxx-xxx-xxxxxxxx
site_name: netlify-subdomain
image: internetmat/drone-netlify
settings:
token:
from_secret: netlify_token
site:
from_secret: netlify_site_id
```

13
manifest.tmpl Normal file
View File

@ -0,0 +1,13 @@
image: internetmat/drone-netlify:{{#if build.tag}}{{trimPrefix build.tag "v"}}{{else}}latest{{/if}}
{{#if build.tags}}
tags:
{{#each build.tags}}
- {{this}}
{{/each}}
{{/if}}
manifests:
-
image: internetmat/drone-netlify:{{#if build.tag}}{{trimPrefix build.tag "v"}}-{{/if}}linux-amd64
platform:
architecture: amd64
os: linux

View File

@ -1,21 +1,19 @@
#!/bin/sh
#!/bin/bash
set -e
NETLIFY_SITE=""
NETLIFY_DEPLOY_OPTIONS=""
NETLIFY_UPDATE_OPTIONS=""
if [ -n "$PLUGIN_ENVIRONMENT" ]
if [ -n "$PLUGIN_PROD" ] && [ "$PLUGIN_PROD" != false ]
then
NETLIFY_DEPLOY_OPTIONS="-e ${PLUGIN_ENVIRONMENT}"
NETLIFY_UPDATE_OPTIONS="${NETLIFY_DEPLOY_OPTIONS}"
NETLIFY_DEPLOY_OPTIONS="--prod"
fi
if [ -n "$PLUGIN_PATH" ]
then
NETLIFY_DEPLOY_OPTIONS="${NETLIFY_DEPLOY_OPTIONS} -p ${PLUGIN_PATH}"
NETLIFY_DEPLOY_OPTIONS="${NETLIFY_DEPLOY_OPTIONS} --dir ${PLUGIN_PATH}"
else
NETLIFY_DEPLOY_OPTIONS="${NETLIFY_DEPLOY_OPTIONS} -p ./"
NETLIFY_DEPLOY_OPTIONS="${NETLIFY_DEPLOY_OPTIONS} --dir ./"
fi
if [ -z "$PLUGIN_TOKEN" ]
@ -29,37 +27,36 @@ then
fi
fi
if [ -n "$PLUGIN_SITE_ID" ] && [ -n "$PLUGIN_TOKEN" ]
if [ -n "$PLUGIN_ALIAS" ]
then
NETLIFY_SITE="-t $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
if [ -n "$PLUGIN_DEBUG" ] && [ "$PLUGIN_DEBUG" != false ]
then
cat netlify.toml
NETLIFY_DEPLOY_OPTIONS="${NETLIFY_DEPLOY_OPTIONS} --debug"
fi
if [ -n "$PLUGIN_SITE" ]
then
NETLIFY_SITE="--auth $PLUGIN_TOKEN --site $PLUGIN_SITE"
echo "> Deploying on Netlify…" &&
netlify $NETLIFY_SITE deploy $NETLIFY_DEPLOY_OPTIONS;
echo "> (Using option $NETLIFY_DEPLOY_OPTIONS)" &&
netlify deploy $NETLIFY_SITE $NETLIFY_DEPLOY_OPTIONS --message "$DRONE_COMMIT_MESSAGE";
else
echo "> Error! site_id and token are required"
echo "> Error! site (site ID or name) and token are required"
exit 1
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=$?;
if [[ $rc != 0 ]];
if [[ $rc != 0 ]]
then
echo "> non-zero exit code $rc" &&
exit $rc
else
echo $'\n'"> Successfully deployed!"$'\n'
fi
fi