Drone.IO is a CI/CD platform that uses Docker Containers for each pipeline step. This makes it easy to use existing Docker containers as steps in your pipeline. You can go futher and create special containers that are designed to be used as steps in your pipeline that accept arguments from the pipeline to run pre-defined tasks.
These plugins can be re-used in Gitea Actions to be able to run the same tasks in Gitea Actions as you would in Drone.
To give an example, a Drone plugin I used was drone-scp, and what it does is to allow me to copy files from the build pipeline to a remote server. I had a step in my Drone pipeline that looked like this:
- name: scp files
image: appleboy/drone-scp
settings:
host: example1.com
username: ubuntu
password:
from_secret: ssh_password
target: /home/deploy/web
source:
- release/*.tar.gz
The workflow step will call a pre-defined binary in the drone-scp Docker image that will copy the files from the release directory to the target directory on the remote server without the need to have that script defined in full in the pipeline.
As this is published as a Docker image, it can be used in Gitea Actions as well. To convert the plugin to one that can be used in Gitea Actions, you need to create a Dockerfile that will be used to build the image that will be used in the Gitea Action. The Dockerfile should look something like this:
FROM appleboy/drone-scp
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
The entrypoint will be a short script that passes all the input arguments for the action to the drone-scp binary. The entrypoint.sh script should look something like this:
#!/bin/sh
set -eu
sh -c "/bin/drone-scp $*"
Finally, you’ll need an action.yml
file that lets Gitea Actions know what inputs should be used.
name: 'drone-scp Gitea Action'
# This tells the Gitea Action runner what type of Action this is
# in this case, it's "docker", and the image to use is the Dockerfile
runs:
using: 'docker'
image: 'Dockerfile'
inputs:
host:
description: 'scp remote host'
# ... define all the remaining inputs that exist for the Drone Plugin
Now, you can reference this action in any Gitea Actions workflow the same way that you would have used the Drone.IO plugin.
An example of
name: copy files
on: [push]
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: https://gitea.com/techknowlogick/scp-gitea-action@main
with:
host: ${{ secrets.HOST }}
...
The author of the SCP Drone plugin, Appleboy, has done exactly this already, and you can use that action from his repo found at https://github.com/appleboy/scp-action/
This is a simple example, but you can convert any Drone plugin to a Gitea Action by following the same steps. This allows you to re-use existing plugins in Gitea Actions without having to re-write the entire plugin, which is especially useful as you can use the programming language of your choice, rather than relying on the ones supported by the runner natively.