Compare commits

...

2 Commits

Author SHA1 Message Date
nemunaire 030913b7a9 Migrate to drone build
continuous-integration/drone/push Build is running Details
2024-04-29 15:28:53 +02:00
rubenelshof db24bc0bdd Add PLUGIN_FTP_USERNAME & PLUGIN_FTP_PASSWORD 2024-04-29 15:22:33 +02:00
4 changed files with 122 additions and 27 deletions

22
.drone-manifest.yml Normal file
View File

@ -0,0 +1,22 @@
image: nemunaire/drone-ftps:{{#if build.tag}}{{trimPrefix "v" build.tag}}{{else}}latest{{/if}}
{{#if build.tags}}
tags:
{{#each build.tags}}
- {{this}}
{{/each}}
{{/if}}
manifests:
- image: nemunaire/drone-ftps:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-amd64
platform:
architecture: amd64
os: linux
- image: nemunaire/drone-ftps:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm64
platform:
architecture: arm64
os: linux
variant: v8
- image: nemunaire/drone-ftps:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm
platform:
architecture: arm
os: linux
variant: v7

92
.drone.yml Normal file
View File

@ -0,0 +1,92 @@
---
kind: pipeline
type: docker
name: build-amd64
platform:
os: linux
arch: amd64
steps:
- name: publish on Docker Hub
image: plugins/docker
settings:
repo: nemunaire/drone-ftps
auto_tag: true
auto_tag_suffix: ${DRONE_STAGE_OS}-${DRONE_STAGE_ARCH}
dockerfile: Dockerfile
username:
from_secret: docker_username
password:
from_secret: docker_password
---
kind: pipeline
type: docker
name: build-arm64
platform:
os: linux
arch: arm64
steps:
- name: publish on Docker Hub
image: plugins/docker
settings:
repo: nemunaire/drone-ftps
auto_tag: true
auto_tag_suffix: ${DRONE_STAGE_OS}-${DRONE_STAGE_ARCH}
dockerfile: Dockerfile
username:
from_secret: docker_username
password:
from_secret: docker_password
---
kind: pipeline
type: docker
name: build-arm
platform:
os: linux
arch: arm
steps:
- name: publish on Docker Hub
image: plugins/docker
settings:
repo: nemunaire/drone-ftps
auto_tag: true
auto_tag_suffix: ${DRONE_STAGE_OS}-${DRONE_STAGE_ARCH}
dockerfile: Dockerfile
username:
from_secret: docker_username
password:
from_secret: docker_password
---
kind: pipeline
name: docker-manifest
steps:
- name: publish on Docker Hub
image: plugins/manifest
settings:
auto_tag: true
ignore_missing: true
spec: .drone-manifest.yml
username:
from_secret: docker_username
password:
from_secret: docker_password
trigger:
event:
- cron
- push
- tag
depends_on:
- build-amd64
- build-arm64
- build-arm

View File

@ -1,25 +0,0 @@
name: Docker Image
on:
push:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Log in to Docker Hub
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push Docker image
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: .
push: true
tags: cschlosser/drone-ftps

View File

@ -1,10 +1,16 @@
#!/bin/bash
if [ -z "$FTP_USERNAME" ]; then
if [[ -z "$FTP_USERNAME" && -z "$PLUGIN_FTP_USERNAME" ]]; then
echo "Need to set username"
exit 1
fi
FTP_USERNAME_STR=""
FTP_PASSWORD_STR=""
[ -n "$PLUGIN_FTP_USERNAME" ] && FTP_USERNAME_STR="$PLUGIN_FTP_USERNAME" || FTP_USERNAME_STR="$FTP_USERNAME"
[ -n "$PLUGIN_FTP_PASSWORD" ] && FTP_PASSWORD_STR="$PLUGIN_FTP_PASSWORD" || FTP_PASSWORD_STR="$FTP_PASSWORD"
if [ -z "$PLUGIN_HOSTNAME" ]; then
echo "Need to set hostname"
exit 1
@ -84,4 +90,4 @@ lftp $PLUGIN_DEBUG -e "set xfer:log 1; \
$PLUGIN_CLEAN_DIR; \
mirror --verbose $PLUGIN_CHMOD -R $PLUGIN_ONLY_NEWER $PLUGIN_MIRROR_OPTS $PLUGIN_INCLUDE_STR $PLUGIN_EXCLUDE_STR $(pwd)$PLUGIN_SRC_DIR $PLUGIN_DEST_DIR; \
$PLUGIN_POST_ACTION;" \
-u $FTP_USERNAME,$FTP_PASSWORD $PLUGIN_HOSTNAME
-u "$FTP_USERNAME_STR","$FTP_PASSWORD_STR" "$PLUGIN_HOSTNAME"