From 98dd13c81ead253d1b99ca09233c86e3fe4f2b51 Mon Sep 17 00:00:00 2001 From: 3wc <3wc@doesthisthing.work> Date: Mon, 4 Aug 2025 17:18:29 +0100 Subject: [PATCH] Initial import --- .drone.yml | 26 ++++++++++++++++++++++++++ Dockerfile | 9 +++++++++ README.md | 30 ++++++++++++++++++++++++++++++ makefile | 15 +++++++++++++++ plugin.sh | 23 +++++++++++++++++++++++ 5 files changed, 103 insertions(+) create mode 100644 .drone.yml create mode 100644 Dockerfile create mode 100644 README.md create mode 100644 makefile create mode 100755 plugin.sh diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..5485f4f --- /dev/null +++ b/.drone.yml @@ -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 diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..a00a8db --- /dev/null +++ b/Dockerfile @@ -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"] diff --git a/README.md b/README.md new file mode 100644 index 0000000..c00152d --- /dev/null +++ b/README.md @@ -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`. diff --git a/makefile b/makefile new file mode 100644 index 0000000..8ca605d --- /dev/null +++ b/makefile @@ -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 diff --git a/plugin.sh b/plugin.sh new file mode 100755 index 0000000..a3a247a --- /dev/null +++ b/plugin.sh @@ -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