From 26c07f0699f18833d781baeea3b94435dad15674 Mon Sep 17 00:00:00 2001 From: Robert Bastian Date: Mon, 1 Dec 2025 17:50:03 +0100 Subject: [PATCH] wip --- .github/workflows/build-json.yml | 25 +++++++++++++++++++++---- cldr-config.sh | 2 +- cldr-generate-json.sh | 3 ++- cldr-generate-zip.sh | 17 ++++++----------- cldr-identify.sh | 3 +-- 5 files changed, 31 insertions(+), 19 deletions(-) mode change 100644 => 100755 cldr-generate-zip.sh diff --git a/.github/workflows/build-json.yml b/.github/workflows/build-json.yml index 91cf748557..e8e9427f44 100644 --- a/.github/workflows/build-json.yml +++ b/.github/workflows/build-json.yml @@ -2,6 +2,7 @@ name: build-json permissions: packages: read + contents: write on: workflow_dispatch: @@ -11,7 +12,7 @@ on: required: false version: description: Package Version (e.g. 46.0.0 or 46.0.0-BETA2 ) - required: true + required: false cldr-repo: description: CLDR (tool) repo to use required: true @@ -32,6 +33,11 @@ on: description: 'Path in Data repo' required: false default: 'production/' + push-changes: + description: 'Push changes to the cldr-json repo' + type: boolean + default: false + required: true jobs: build: @@ -48,6 +54,7 @@ jobs: with: ref: ${{ github.event.inputs.git-ref }} path: cldr-json + fetch-depth: 0 - name: Clone cldr uses: actions/checkout@v5 with: @@ -55,6 +62,7 @@ jobs: lfs: false repository: ${{ github.event.inputs.cldr-repo }} path: cldr + fetch-depth: 0 - name: Cache local Maven repository uses: actions/cache@v4 with: @@ -71,12 +79,12 @@ jobs: repository: ${{ github.event.inputs.data-repo }} sparse-checkout: ${{ github.event.inputs.data-dir }} path: cldr-staging + fetch-depth: 0 - name: Setup Config working-directory: cldr-json run: | - echo VERSION=${{ github.event.inputs.version }} > local-config.sh - cat local-config.sh - chmod a+rx local-config.sh + [ -n "${{ github.event.inputs.version }}" ] && echo VERSION=${{ github.event.inputs.version }} > local-config.sh + chmod +x local-config.sh || true bash cldr-identify.sh | tee ../cldr-identity.txt - name: Upload cldr-identity.txt uses: actions/upload-artifact@v4 @@ -103,6 +111,15 @@ jobs: with: name: cldr-json path: ./cldr-json/dist + - name: Push changes + if: ${{ github.event.inputs.push-changes }} + working-directory: cldr-json + run: | + git config --global user.name "GitHub Actions" + git config --global user.email "actions@github.com" + git add cldr-json + git commit --verbose -F - < (echo "Automated update; echo; cat ../cldr-identity.txt") + git push --verbose diff --git a/cldr-config.sh b/cldr-config.sh index 0802db4783..6bb115baf2 100755 --- a/cldr-config.sh +++ b/cldr-config.sh @@ -26,6 +26,6 @@ MATCH='.*' DRAFTSTATUS="contributed" # override the version number of CLDR -#VERSION="39.0.0" +VERSION="49.0.0-dev" EXTRA_JSON_OPTS="" diff --git a/cldr-generate-json.sh b/cldr-generate-json.sh index c3ae435941..d92ff575a6 100755 --- a/cldr-generate-json.sh +++ b/cldr-generate-json.sh @@ -33,8 +33,9 @@ then ${MVN} exec:java -Dexec.mainClass=org.unicode.cldr.tool.GenerateProductionData -DCLDR_DIR=${CLDR_DIR} -Dexec.args="-d ${INDATA}/common" fi +mkdir -p ${OUT} # for now, seed has to exist. -mkdir -p -v ${OUT} ${INDATA}/seed/main ${INDATA}/seed/annotations ${DIST} +mkdir -p -v ${INDATA}/seed/{main,annotations} for type in ${TYPES}; do ${MVN} exec:java -Dexec.mainClass=org.unicode.cldr.json.Ldml2JsonConverter -DCLDR_DIR=${INDATA} -Dexec.args="-m ${MATCH} -p true -o true -r true -t ${type} -d ${OUT} -s ${DRAFTSTATUS} -V ${VERSION} ${EXTRA_JSON_OPTS}" diff --git a/cldr-generate-zip.sh b/cldr-generate-zip.sh old mode 100644 new mode 100755 index 5c3bcafb18..f5fa1eb542 --- a/cldr-generate-zip.sh +++ b/cldr-generate-zip.sh @@ -12,16 +12,11 @@ then . ./local-config.sh fi -if [[ -z "$VERSION" ]]; -then - echo "VERSION is undefined, exiting from $0" - exit 1 -fi +VERSION="$(jq -r .version cldr-json/cldr-core/package.json)" +DIST=$(pwd)/${DIST} set -x -( cd ${OUT} && cp ../LICENSE LICENSE ) -( cd ${OUT} && zip -x "*/.DS_Store" -r cldr-${VERSION}-json-full.zip LICENSE cldr-core cldr-rbnf cldr-*-full cldr-bcp47 cldr-transforms ) -#( cd ${OUT} && zip -r cldr-${VERSION}-json-modern.zip LICENSE cldr-core cldr-rbnf cldr-*-modern cldr-bcp47 cldr-transforms ) -( cd ${OUT} && rm LICENSE ) - -mv -v ${OUT}/*.zip ${DIST}/ +mkdir -p ${DIST} +cp LICENSE ${OUT}/LICENSE +( cd ${OUT} && zip -x "*/.DS_Store" -r ${DIST}/cldr-${VERSION}-json-full.zip * ) +rm ${OUT}/LICENSE diff --git a/cldr-identify.sh b/cldr-identify.sh index 909cf5f9b1..c44f9f999c 100755 --- a/cldr-identify.sh +++ b/cldr-identify.sh @@ -15,10 +15,9 @@ fi function explain_repo() { git remote get-url origin | sed -E 's/git@github.com:|https:\/\/github.com\/|.git//g' - git describe --tags HEAD + git describe --tags --always HEAD } -echo "* cldr-json info" if [[ "$INDATA" == "generate" ]] then echo "- DATA: " $(cd ${CLDR_DIR}; explain_repo) "(generated)"