Initial import
Some checks failed
continuous-integration/drone Build is failing

This commit is contained in:
3wc
2025-08-04 17:18:29 +01:00
commit 98dd13c81e
5 changed files with 103 additions and 0 deletions

26
.drone.yml Normal file
View File

@ -0,0 +1,26 @@
---
kind: pipeline
name: deploy to git.coopcloud.tech
steps:
- name: run shellcheck
image: debian:buster
commands:
- apt update
- apt install -y shellcheck
- shellcheck plugin.sh
- name: publish image
image: plugins/docker
settings:
username: abra-bot
password:
from_secret: git_coopcloud_tech_token_abra_bot
repo: git.coopcloud.tech/toolshed/drone-xgotext
registry: git.coopcloud.tech
tags: latest
purge: true
pull_image: true
trigger:
branch:
- main

9
Dockerfile Normal file
View File

@ -0,0 +1,9 @@
FROM golang:1.24-alpine AS build
RUN go install github.com/leonelquinteros/gotext/cli/xgotext@latest
WORKDIR /drone/src
COPY plugin.sh /plugin/plugin.sh
ENTRYPOINT ["/plugin/plugin.sh"]

30
README.md Normal file
View File

@ -0,0 +1,30 @@
# drone-abra
[![Build Status](https://build.coopcloud.tech/api/badges/toolshed/drone-abra/status.svg?ref=refs/heads/main)](https://build.coopcloud.tech/toolshed/drone-abra)
Use [`xgotext` ](https://github.com/leonelquinteros/gotext/tree/master/cli/xgotext) as a Drone plugin.
## Settings
### Optional
- **in**: (default: `/drone/src`) The source directory to scan for Gettext settings
- **out:** (default: `/drone/src/locales`) The target directory in which to create a `pot` file.
- **exclude** (default: `.git`) Comma-separated directories to exclude from processing
## Example
```yaml
---
kind: pipeline
name: Update Gettext catalog template
steps:
- name: Run xgotext
image: git.coopcloud.tech/toolshed/drone-xgotext
```
## Publishing
The version can be bumped in the [.drone.yml](./.drone.yml) file. We're sticking with `latest` as we iterate on the code right now.
If you push a commit to master, the [Drone config](./.drone.yml) will publish to `git.coopcloud.tech`.

15
makefile Normal file
View File

@ -0,0 +1,15 @@
.PHONY: build push shellcheck
shellcheck:
@docker run \
-it \
--rm \
-v $$(pwd):/workdir \
koalaman/shellcheck-alpine \
shellcheck /workdir/plugin.sh
build:
@ docker build -t git.coopcloud.tech/toolshed/drone-xgotext .
push: build
@docker push git.coopcloud.tech/toolshed/drone-xgotext

23
plugin.sh Executable file
View File

@ -0,0 +1,23 @@
#!/bin/sh
set -e
PLUGIN_IN=${PLUGIN_IN:-/drone/src/}
PLUGIN_OUT=${PLUGIN_OUT:-/drone/src/locales/}
PLUGIN_EXCLUDE=${PLUGIN_EXCLUDE:-}
run_xgotext_cmd() {
echo "--- start command ---"
xgotext -in "$PLUGIN_IN" -out "$PLUGIN_OUT" ${PLUGIN_EXCLUDE:+-exclude} "$PLUGIN_EXCLUDE"
echo "--- end command ---"
}
run_plugin() {
echo "--- start drone-xgotext ---"
run_xgotext_cmd
echo "--- end drone-xgotext ---"
}
run_plugin