diff --git a/.github/workflows/update-zim-offliner-definition.yaml b/.github/workflows/update-zim-offliner-definition.yaml new file mode 100644 index 0000000..f91f48c --- /dev/null +++ b/.github/workflows/update-zim-offliner-definition.yaml @@ -0,0 +1,38 @@ +name: Update ZIMFarm Definitions + +on: + push: + branches: [main] + paths: + - "offliner-definition.json" + release: + types: [published] + +jobs: + prepare-json: + runs-on: ubuntu-24.04 + outputs: + offliner_definition: ${{ steps.read-json.outputs.offliner_definition }} + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - id: read-json + run: | + if [ ! -f "offliner-definition.json" ]; then + echo "File not found!" >&2 + exit 1 + fi + json=$(jq -c . offliner-definition.json) + echo "offliner_definition=$json" >> $GITHUB_OUTPUT + call-workflow: + needs: prepare-json + uses: openzim/overview/.github/workflows/update-zimfarm-offliner-definition.yaml + with: + version: ${{ github.event_name == 'release' && github.event.release.tag_name || 'dev' }} + offliner: devdocs + offliner_definition: ${{ needs.prepare-json.outputs.offliner_definition }} + secrets: + zimfarm_ci_secret: ${{ secrets.ZIMFARM_CI_SECRET }} diff --git a/offliner-definition.json b/offliner-definition.json new file mode 100644 index 0000000..fe5d9e3 --- /dev/null +++ b/offliner-definition.json @@ -0,0 +1,100 @@ +{ + "offliner_id": "devdocs", + "stdOutput": true, + "stdStats": false, + "flags": { + "slug": { + "type": "string", + "required": false, + "title": "Slug", + "description": "Fetch the provided Devdocs resource. Slugs are the first path entry in the Devdocs URL. For example, the slug for: `https://devdocs.io/gcc~12/` is `gcc~12`. Mutually exclusive with `All` setting, set only one option. Either this setting or `All` must be configured." + }, + "all_flag": { + "type": "boolean", + "required": false, + "title": "All", + "description": "Fetch all Devdocs resources, and produce one ZIM per resource. Mutually exclusive with `Slug` setting, set only one option. Either this setting or `Slug` must be configured.", + "alias": "all" + }, + "skip_slug_regex": { + "type": "string", + "required": false, + "title": "Skip slugs regex", + "description": "Skips slugs matching the given regular expression. Do not set to fetch all slugs. Only useful when `All` is set." + }, + "file_name_format": { + "type": "string", + "required": false, + "title": "ZIM filename", + "description": "ZIM filename. Do not input trailing `.zim`, it will be automatically added. You can use placeholders, see https://github.com/openzim/devdocs/blob/main/README.md. Defaults to devdocs.io_en_{clean_slug}_{period}" + }, + "name_format": { + "type": "string", + "required": false, + "title": "ZIM name", + "description": "ZIM name. You can use placeholders, see https://github.com/openzim/devdocs/blob/main/README.md. Defaults to devdocs.io_en_{clean_slug}" + }, + "title_format": { + "type": "string", + "required": false, + "title": "ZIM title", + "description": "ZIM title. You can use placeholders, see https://github.com/openzim/devdocs/blob/main/README.md. Defaults to {full_name} Docs", + "minLength": 1, + "maxLength": 30 + }, + "description_format": { + "type": "string", + "required": false, + "title": "ZIM description", + "description": "ZIM description. You can use placeholders, see https://github.com/openzim/devdocs/blob/main/README.md. Defaults to {full_name} docs by DevDocs", + "minLength": 1, + "maxLength": 80 + }, + "long_description_format": { + "type": "string", + "required": false, + "title": "ZIM long description", + "description": "ZIM long description. You can use placeholders, see https://github.com/openzim/devdocs/blob/main/README.md. Defaults to no long description", + "minLength": 1, + "maxLength": 4000 + }, + "logo_format": { + "type": "string", + "required": false, + "title": "ZIM illustration", + "description": "URL to a custom ZIM logo in PNG, JPG, or SVG format. You can use placeholders, see https://github.com/openzim/devdocs/blob/main/README.md." + }, + "tags": { + "type": "string", + "required": false, + "title": "ZIM Tags", + "description": "List of semi-colon-separated Tags for the ZIM file. You can use placeholders, see https://github.com/openzim/devdocs/blob/main/README.md. Defaults to devdocs;{slug_without_version}" + }, + "creator": { + "type": "string", + "required": false, + "title": "Creator", + "description": "Name of content creator. “DevDocs” otherwise" + }, + "publisher": { + "type": "string", + "required": false, + "title": "Publisher", + "isPublisher": true, + "description": "Custom publisher name (ZIM metadata). “openZIM” otherwise" + }, + "output": { + "type": "string", + "required": false, + "title": "Output folder", + "description": "Output folder for ZIM file(s). Leave it as `/output`", + "pattern": "^/output$" + }, + "debug": { + "type": "boolean", + "required": false, + "title": "Debug", + "description": "Enable verbose output" + } + } +}