ci: auto extract translation strings (#8417)
Co-authored-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
committed by
GitHub
parent
a395e347df
commit
a71948c9b7
1
.github/pull_request_template.md
vendored
1
.github/pull_request_template.md
vendored
@ -27,7 +27,6 @@ If an API change has been made
|
|||||||
If changes to the frontend have been made
|
If changes to the frontend have been made
|
||||||
|
|
||||||
- [ ] The code has been formatted (`make web`)
|
- [ ] The code has been formatted (`make web`)
|
||||||
- [ ] The translation files have been updated (`make i18n-extract`)
|
|
||||||
|
|
||||||
If applicable
|
If applicable
|
||||||
|
|
||||||
|
|||||||
@ -1,9 +1,8 @@
|
|||||||
name: authentik-backend-translate-compile
|
---
|
||||||
|
name: authentik-backend-translate-extract-compile
|
||||||
on:
|
on:
|
||||||
push:
|
schedule:
|
||||||
branches: [main]
|
- cron: "0 0 * * *" # every day at midnight
|
||||||
paths:
|
|
||||||
- "locale/**"
|
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
env:
|
env:
|
||||||
@ -25,16 +24,20 @@ jobs:
|
|||||||
token: ${{ steps.generate_token.outputs.token }}
|
token: ${{ steps.generate_token.outputs.token }}
|
||||||
- name: Setup authentik env
|
- name: Setup authentik env
|
||||||
uses: ./.github/actions/setup
|
uses: ./.github/actions/setup
|
||||||
|
- name: run extract
|
||||||
|
run: |
|
||||||
|
poetry run make i18n-extract
|
||||||
- name: run compile
|
- name: run compile
|
||||||
run: poetry run ak compilemessages
|
run: |
|
||||||
|
poetry run ak compilemessages
|
||||||
|
make web-check-compile
|
||||||
- name: Create Pull Request
|
- name: Create Pull Request
|
||||||
uses: peter-evans/create-pull-request@v6
|
uses: peter-evans/create-pull-request@v6
|
||||||
id: cpr
|
|
||||||
with:
|
with:
|
||||||
token: ${{ steps.generate_token.outputs.token }}
|
token: ${{ steps.generate_token.outputs.token }}
|
||||||
branch: compile-backend-translation
|
branch: extract-compile-backend-translation
|
||||||
commit-message: "core: compile backend translations"
|
commit-message: "core, web: update translations"
|
||||||
title: "core: compile backend translations"
|
title: "core, web: update translations"
|
||||||
body: "core: compile backend translations"
|
body: "core, web: update translations"
|
||||||
delete-branch: true
|
delete-branch: true
|
||||||
signoff: true
|
signoff: true
|
||||||
35
Makefile
35
Makefile
@ -8,6 +8,9 @@ NPM_VERSION = $(shell python -m scripts.npm_version)
|
|||||||
PY_SOURCES = authentik tests scripts lifecycle
|
PY_SOURCES = authentik tests scripts lifecycle
|
||||||
DOCKER_IMAGE ?= "authentik:test"
|
DOCKER_IMAGE ?= "authentik:test"
|
||||||
|
|
||||||
|
GEN_API_TS = "gen-ts-api"
|
||||||
|
GEN_API_GO = "gen-go-api"
|
||||||
|
|
||||||
pg_user := $(shell python -m authentik.lib.config postgresql.user 2>/dev/null)
|
pg_user := $(shell python -m authentik.lib.config postgresql.user 2>/dev/null)
|
||||||
pg_host := $(shell python -m authentik.lib.config postgresql.host 2>/dev/null)
|
pg_host := $(shell python -m authentik.lib.config postgresql.host 2>/dev/null)
|
||||||
pg_name := $(shell python -m authentik.lib.config postgresql.name 2>/dev/null)
|
pg_name := $(shell python -m authentik.lib.config postgresql.name 2>/dev/null)
|
||||||
@ -76,7 +79,7 @@ migrate: ## Run the Authentik Django server's migrations
|
|||||||
i18n-extract: core-i18n-extract web-i18n-extract ## Extract strings that require translation into files to send to a translation service
|
i18n-extract: core-i18n-extract web-i18n-extract ## Extract strings that require translation into files to send to a translation service
|
||||||
|
|
||||||
core-i18n-extract:
|
core-i18n-extract:
|
||||||
ak makemessages --ignore web --ignore internal --ignore web --ignore web-api --ignore website -l en
|
ak makemessages --ignore web --ignore internal --ignore ${GEN_API_TS} --ignore website -l en
|
||||||
|
|
||||||
install: web-install website-install core-install ## Install all requires dependencies for `web`, `website` and `core`
|
install: web-install website-install core-install ## Install all requires dependencies for `web`, `website` and `core`
|
||||||
|
|
||||||
@ -123,11 +126,11 @@ gen-diff: ## (Release) generate the changelog diff between the current schema a
|
|||||||
npx prettier --write diff.md
|
npx prettier --write diff.md
|
||||||
|
|
||||||
gen-clean-ts: ## Remove generated API client for Typescript
|
gen-clean-ts: ## Remove generated API client for Typescript
|
||||||
rm -rf gen-ts-api/
|
rm -rf ./${GEN_API_TS}/
|
||||||
rm -rf web/node_modules/@goauthentik/api/
|
rm -rf ./web/node_modules/@goauthentik/api/
|
||||||
|
|
||||||
gen-clean-go: ## Remove generated API client for Go
|
gen-clean-go: ## Remove generated API client for Go
|
||||||
rm -rf gen-go-api/
|
rm -rf ./${GEN_API_GO}/
|
||||||
|
|
||||||
gen-clean: gen-clean-ts gen-clean-go ## Remove generated API clients
|
gen-clean: gen-clean-ts gen-clean-go ## Remove generated API clients
|
||||||
|
|
||||||
@ -138,31 +141,31 @@ gen-client-ts: gen-clean-ts ## Build and install the authentik API for Typescri
|
|||||||
docker.io/openapitools/openapi-generator-cli:v6.5.0 generate \
|
docker.io/openapitools/openapi-generator-cli:v6.5.0 generate \
|
||||||
-i /local/schema.yml \
|
-i /local/schema.yml \
|
||||||
-g typescript-fetch \
|
-g typescript-fetch \
|
||||||
-o /local/gen-ts-api \
|
-o /local/${GEN_API_TS} \
|
||||||
-c /local/scripts/api-ts-config.yaml \
|
-c /local/scripts/api-ts-config.yaml \
|
||||||
--additional-properties=npmVersion=${NPM_VERSION} \
|
--additional-properties=npmVersion=${NPM_VERSION} \
|
||||||
--git-repo-id authentik \
|
--git-repo-id authentik \
|
||||||
--git-user-id goauthentik
|
--git-user-id goauthentik
|
||||||
mkdir -p web/node_modules/@goauthentik/api
|
mkdir -p web/node_modules/@goauthentik/api
|
||||||
cd gen-ts-api && npm i
|
cd ./${GEN_API_TS} && npm i
|
||||||
\cp -rfv gen-ts-api/* web/node_modules/@goauthentik/api
|
\cp -rfv ./${GEN_API_TS}/* web/node_modules/@goauthentik/api
|
||||||
|
|
||||||
gen-client-go: gen-clean-go ## Build and install the authentik API for Golang
|
gen-client-go: gen-clean-go ## Build and install the authentik API for Golang
|
||||||
mkdir -p ./gen-go-api ./gen-go-api/templates
|
mkdir -p ./${GEN_API_GO} ./${GEN_API_GO}/templates
|
||||||
wget https://raw.githubusercontent.com/goauthentik/client-go/main/config.yaml -O ./gen-go-api/config.yaml
|
wget https://raw.githubusercontent.com/goauthentik/client-go/main/config.yaml -O ./${GEN_API_GO}/config.yaml
|
||||||
wget https://raw.githubusercontent.com/goauthentik/client-go/main/templates/README.mustache -O ./gen-go-api/templates/README.mustache
|
wget https://raw.githubusercontent.com/goauthentik/client-go/main/templates/README.mustache -O ./${GEN_API_GO}/templates/README.mustache
|
||||||
wget https://raw.githubusercontent.com/goauthentik/client-go/main/templates/go.mod.mustache -O ./gen-go-api/templates/go.mod.mustache
|
wget https://raw.githubusercontent.com/goauthentik/client-go/main/templates/go.mod.mustache -O ./${GEN_API_GO}/templates/go.mod.mustache
|
||||||
cp schema.yml ./gen-go-api/
|
cp schema.yml ./${GEN_API_GO}/
|
||||||
docker run \
|
docker run \
|
||||||
--rm -v ${PWD}/gen-go-api:/local \
|
--rm -v ${PWD}/${GEN_API_GO}:/local \
|
||||||
--user ${UID}:${GID} \
|
--user ${UID}:${GID} \
|
||||||
docker.io/openapitools/openapi-generator-cli:v6.5.0 generate \
|
docker.io/openapitools/openapi-generator-cli:v6.5.0 generate \
|
||||||
-i /local/schema.yml \
|
-i /local/schema.yml \
|
||||||
-g go \
|
-g go \
|
||||||
-o /local/ \
|
-o /local/ \
|
||||||
-c /local/config.yaml
|
-c /local/config.yaml
|
||||||
go mod edit -replace goauthentik.io/api/v3=./gen-go-api
|
go mod edit -replace goauthentik.io/api/v3=./${GEN_API_GO}
|
||||||
rm -rf ./gen-go-api/config.yaml ./gen-go-api/templates/
|
rm -rf ./${GEN_API_GO}/config.yaml ./${GEN_API_GO}/templates/
|
||||||
|
|
||||||
gen-dev-config: ## Generate a local development config file
|
gen-dev-config: ## Generate a local development config file
|
||||||
python -m scripts.generate_config
|
python -m scripts.generate_config
|
||||||
@ -176,7 +179,7 @@ gen: gen-build gen-client-ts
|
|||||||
web-build: web-install ## Build the Authentik UI
|
web-build: web-install ## Build the Authentik UI
|
||||||
cd web && npm run build
|
cd web && npm run build
|
||||||
|
|
||||||
web: web-lint-fix web-lint web-check-compile web-i18n-extract ## Automatically fix formatting issues in the Authentik UI source code, lint the code, and compile it
|
web: web-lint-fix web-lint web-check-compile ## Automatically fix formatting issues in the Authentik UI source code, lint the code, and compile it
|
||||||
|
|
||||||
web-install: ## Install the necessary libraries to build the Authentik UI
|
web-install: ## Install the necessary libraries to build the Authentik UI
|
||||||
cd web && npm ci
|
cd web && npm ci
|
||||||
|
|||||||
Reference in New Issue
Block a user