diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 046082f..e4e61bb 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -46,8 +46,10 @@ jobs: needs: check-version runs-on: ubuntu-latest env: - DEV_DIR: ${{ github.ref_name == 'main' && './public' || './public/dev' }} + BUILD_DIR: ${{ github.ref_name == 'main' && './public' || './public/dev' }} RELEASE_VERSION: ${{ needs.check-version.outputs.is_new == 'true' && needs.check-version.outputs.version || '' }} + IS_MAIN: ${{ github.ref_name == 'main' && 'true' || 'false' }} + CURRENT_VERSION: ${{ needs.check-version.outputs.version }} steps: - name: Checkout uses: actions/checkout@v4 @@ -117,11 +119,11 @@ jobs: - name: Generate ontology syntaxes and documentation run: | - python3 src/scripts/onto_syntax_doc.py + python3 src/scripts/ontology_build.py - - name: Upload dev artifact - # if DEV_DIR is set to something non-empty, we upload the whole public struct - if: ${{ env.DEV_DIR != '' && env.DEV_DIR != null }} + - name: Upload root artifact + # if BUILD_DIR is set to something non-empty, we upload the whole public struct + if: ${{ env.BUILD_DIR != '' && env.BUILD_DIR != null }} uses: actions/upload-artifact@v4 with: name: site diff --git a/src/scripts/onto_syntax_doc.py b/src/scripts/ontology_build.py similarity index 76% rename from src/scripts/onto_syntax_doc.py rename to src/scripts/ontology_build.py index 86003d1..de50eb0 100644 --- a/src/scripts/onto_syntax_doc.py +++ b/src/scripts/ontology_build.py @@ -12,7 +12,9 @@ RELEASES_DIR = os.environ['RELEASES_DIR'] RELEASE_VERSION = os.environ.get('RELEASE_VERSION') -DEV_DIR = os.environ.get('DEV_DIR') +BUILD_DIR = os.environ.get('BUILD_DIR') +IS_MAIN = os.environ.get('IS_MAIN') == 'true' +CURRENT_VERSION = os.environ.get('CURRENT_VERSION', '') g = Graph() g.parse(os.path.join(ONTO_DIR, ONTO_FILE)) @@ -102,21 +104,32 @@ def generate_widoco_docs(outdir, onto_dir, onto_file, version="1.4.25"): f.write(f'
  • {r}
  • \n') f.write("\n\n") -if DEV_DIR: - # --- development build --- - generate_syntaxes(DEV_DIR) +if BUILD_DIR: + # --- base build --- + generate_syntaxes(BUILD_DIR) - dev_docs_dir = os.path.join(DEV_DIR, "docs") - generate_pylode_docs(dev_docs_dir) - generate_widoco_docs(dev_docs_dir, ONTO_DIR, ONTO_FILE) + build_docs_dir = os.path.join(BUILD_DIR, "docs") + generate_pylode_docs(build_docs_dir) + generate_widoco_docs(build_docs_dir, ONTO_DIR, ONTO_FILE) - # Generate dev index.html - dev_index = os.path.join(DEV_DIR, 'index.html') - with open(dev_index, 'w') as f: - f.write("FUEL Development Build\n") - f.write("

    FUEL Ontology (Development)

    \n\n") + if IS_MAIN: + f.write('

    Previous Releases

    \n') + f.write('

    Development Build

    \n') + f.write("\n") \ No newline at end of file