Switch to xgettext-go
This commit is contained in:
@ -15,7 +15,7 @@ steps:
|
|||||||
username: abra-bot
|
username: abra-bot
|
||||||
password:
|
password:
|
||||||
from_secret: git_coopcloud_tech_token_abra_bot
|
from_secret: git_coopcloud_tech_token_abra_bot
|
||||||
repo: git.coopcloud.tech/toolshed/drone-xgotext
|
repo: git.coopcloud.tech/toolshed/drone-xgettext-go
|
||||||
registry: git.coopcloud.tech
|
registry: git.coopcloud.tech
|
||||||
tags: latest
|
tags: latest
|
||||||
purge: true
|
purge: true
|
||||||
|
@ -1,9 +1,15 @@
|
|||||||
FROM golang:1.24-alpine AS build
|
FROM golang:1.24-alpine AS build
|
||||||
|
|
||||||
RUN go install github.com/leonelquinteros/gotext/cli/xgotext@latest
|
RUN apk add git && \
|
||||||
|
git clone https://github.com/snapcore/snapd/ /tmp/snapd/ && \
|
||||||
|
cd /tmp/snapd/i18n/xgettext-go && \
|
||||||
|
go build
|
||||||
|
|
||||||
|
FROM golang:1.24-alpine
|
||||||
|
|
||||||
WORKDIR /drone/src
|
WORKDIR /drone/src
|
||||||
|
|
||||||
|
COPY --from=build /tmp/snapd/i18n/xgettext-go/xgettext-go /bin/xgettext-go
|
||||||
COPY plugin.sh /plugin/plugin.sh
|
COPY plugin.sh /plugin/plugin.sh
|
||||||
|
|
||||||
ENTRYPOINT ["/plugin/plugin.sh"]
|
ENTRYPOINT ["/plugin/plugin.sh"]
|
||||||
|
16
README.md
16
README.md
@ -1,16 +1,18 @@
|
|||||||
# drone-abra
|
# drone-xgettext-go
|
||||||
|
|
||||||
[](https://build.coopcloud.tech/toolshed/drone-abra)
|
[](https://build.coopcloud.tech/toolshed/drone-abra)
|
||||||
|
|
||||||
Use [`xgotext` ](https://github.com/leonelquinteros/gotext/tree/master/cli/xgotext) as a Drone plugin.
|
Use `xgettext-go` as a Drone plugin.
|
||||||
|
|
||||||
|
!!! warning "Caution!"
|
||||||
|
This is currently configured very specifically for use with Co-op Cloud abra. More customisability Coming Soon™, see #1
|
||||||
|
|
||||||
## Settings
|
## Settings
|
||||||
|
|
||||||
### Optional
|
### Optional
|
||||||
|
|
||||||
- **in**: (default: `/drone/src`) The source directory to scan for Gettext settings
|
- **in**: (default: `/drone/src`) The source directory to scan for source files
|
||||||
- **out:** (default: `/drone/src/locales`) The target directory in which to create a `pot` file.
|
- **out:** (default: `/drone/src/locales/default.pot`) The target directory in which to create a `pot` file.
|
||||||
- **exclude** (default: `.git`) Comma-separated directories to exclude from processing
|
|
||||||
|
|
||||||
## Example
|
## Example
|
||||||
|
|
||||||
@ -19,8 +21,8 @@ Use [`xgotext` ](https://github.com/leonelquinteros/gotext/tree/master/cli/xgote
|
|||||||
kind: pipeline
|
kind: pipeline
|
||||||
name: Update Gettext catalog template
|
name: Update Gettext catalog template
|
||||||
steps:
|
steps:
|
||||||
- name: Run xgotext
|
- name: Run xgettext-go
|
||||||
image: git.coopcloud.tech/toolshed/drone-xgotext
|
image: git.coopcloud.tech/toolshed/drone-xgettext-go
|
||||||
```
|
```
|
||||||
|
|
||||||
## Publishing
|
## Publishing
|
||||||
|
16
plugin.sh
16
plugin.sh
@ -1,22 +1,26 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
set -e
|
set -ex
|
||||||
|
|
||||||
PLUGIN_IN=${PLUGIN_IN:-/drone/src/}
|
PLUGIN_IN=${PLUGIN_IN:-/drone/src/}
|
||||||
PLUGIN_OUT=${PLUGIN_OUT:-/drone/src/locales/}
|
PLUGIN_OUT=${PLUGIN_OUT:-/drone/src/locales/default.pot}
|
||||||
PLUGIN_EXCLUDE=${PLUGIN_EXCLUDE:-}
|
# PLUGIN_KEYWORD=${PLUGIN_KEYWORD:-gotext.Get}
|
||||||
|
|
||||||
run_xgotext_cmd() {
|
run_xgettext_cmd() {
|
||||||
echo "--- start command ---"
|
echo "--- start command ---"
|
||||||
|
|
||||||
xgotext -v -in "$PLUGIN_IN" -out "$PLUGIN_OUT" ${PLUGIN_EXCLUDE:+-exclude} "$PLUGIN_EXCLUDE"
|
xgettext-go \
|
||||||
|
-o "$PLUGIN_OUT" \
|
||||||
|
--keyword="i18n.G" \
|
||||||
|
--sort-output \
|
||||||
|
$(find "$PLUGIN_IN" -name "*.go" -not -path '*vendor*')
|
||||||
|
|
||||||
echo "--- end command ---"
|
echo "--- end command ---"
|
||||||
}
|
}
|
||||||
|
|
||||||
run_plugin() {
|
run_plugin() {
|
||||||
echo "--- start drone-xgotext ---"
|
echo "--- start drone-xgotext ---"
|
||||||
run_xgotext_cmd
|
run_xgettext_cmd
|
||||||
echo "--- end drone-xgotext ---"
|
echo "--- end drone-xgotext ---"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user