diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 9deccbc2ec..54e9b8b5b0 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -27,7 +27,6 @@ If an API change has been made If changes to the frontend have been made - [ ] The code has been formatted (`make web`) -- [ ] The translation files have been updated (`make i18n-extract`) If applicable diff --git a/.github/workflows/translation-compile.yml b/.github/workflows/translation-extract-compile.yml similarity index 61% rename from .github/workflows/translation-compile.yml rename to .github/workflows/translation-extract-compile.yml index 1d5e7873d0..eee769ff2e 100644 --- a/.github/workflows/translation-compile.yml +++ b/.github/workflows/translation-extract-compile.yml @@ -1,9 +1,8 @@ -name: authentik-backend-translate-compile +--- +name: authentik-backend-translate-extract-compile on: - push: - branches: [main] - paths: - - "locale/**" + schedule: + - cron: "0 0 * * *" # every day at midnight workflow_dispatch: env: @@ -25,16 +24,20 @@ jobs: token: ${{ steps.generate_token.outputs.token }} - name: Setup authentik env uses: ./.github/actions/setup + - name: run extract + run: | + poetry run make i18n-extract - name: run compile - run: poetry run ak compilemessages + run: | + poetry run ak compilemessages + make web-check-compile - name: Create Pull Request uses: peter-evans/create-pull-request@v6 - id: cpr with: token: ${{ steps.generate_token.outputs.token }} - branch: compile-backend-translation - commit-message: "core: compile backend translations" - title: "core: compile backend translations" - body: "core: compile backend translations" + branch: extract-compile-backend-translation + commit-message: "core, web: update translations" + title: "core, web: update translations" + body: "core, web: update translations" delete-branch: true signoff: true diff --git a/Makefile b/Makefile index e72db46279..73b4319c1b 100644 --- a/Makefile +++ b/Makefile @@ -8,6 +8,9 @@ NPM_VERSION = $(shell python -m scripts.npm_version) PY_SOURCES = authentik tests scripts lifecycle 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_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) @@ -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 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` @@ -123,11 +126,11 @@ gen-diff: ## (Release) generate the changelog diff between the current schema a npx prettier --write diff.md gen-clean-ts: ## Remove generated API client for Typescript - rm -rf gen-ts-api/ - rm -rf web/node_modules/@goauthentik/api/ + rm -rf ./${GEN_API_TS}/ + rm -rf ./web/node_modules/@goauthentik/api/ 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 @@ -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 \ -i /local/schema.yml \ -g typescript-fetch \ - -o /local/gen-ts-api \ + -o /local/${GEN_API_TS} \ -c /local/scripts/api-ts-config.yaml \ --additional-properties=npmVersion=${NPM_VERSION} \ --git-repo-id authentik \ --git-user-id goauthentik mkdir -p web/node_modules/@goauthentik/api - cd gen-ts-api && npm i - \cp -rfv gen-ts-api/* web/node_modules/@goauthentik/api + cd ./${GEN_API_TS} && npm i + \cp -rfv ./${GEN_API_TS}/* web/node_modules/@goauthentik/api gen-client-go: gen-clean-go ## Build and install the authentik API for Golang - mkdir -p ./gen-go-api ./gen-go-api/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/templates/README.mustache -O ./gen-go-api/templates/README.mustache - wget https://raw.githubusercontent.com/goauthentik/client-go/main/templates/go.mod.mustache -O ./gen-go-api/templates/go.mod.mustache - cp schema.yml ./gen-go-api/ + mkdir -p ./${GEN_API_GO} ./${GEN_API_GO}/templates + 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_API_GO}/templates/README.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_API_GO}/ docker run \ - --rm -v ${PWD}/gen-go-api:/local \ + --rm -v ${PWD}/${GEN_API_GO}:/local \ --user ${UID}:${GID} \ docker.io/openapitools/openapi-generator-cli:v6.5.0 generate \ -i /local/schema.yml \ -g go \ -o /local/ \ -c /local/config.yaml - go mod edit -replace goauthentik.io/api/v3=./gen-go-api - rm -rf ./gen-go-api/config.yaml ./gen-go-api/templates/ + go mod edit -replace goauthentik.io/api/v3=./${GEN_API_GO} + rm -rf ./${GEN_API_GO}/config.yaml ./${GEN_API_GO}/templates/ gen-dev-config: ## Generate a local development config file python -m scripts.generate_config @@ -176,7 +179,7 @@ gen: gen-build gen-client-ts web-build: web-install ## Build the Authentik UI 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 cd web && npm ci