From a150de382b76df9d396587630a21bbdfd93f839c Mon Sep 17 00:00:00 2001 From: Federico Tomassetti Date: Mon, 20 Jan 2025 17:32:07 +0100 Subject: [PATCH 01/11] update publication workflow --- .github/workflows/build-documentation.yml | 56 +++++++++++------------ 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/.github/workflows/build-documentation.yml b/.github/workflows/build-documentation.yml index c746f95..b4db9a8 100644 --- a/.github/workflows/build-documentation.yml +++ b/.github/workflows/build-documentation.yml @@ -1,7 +1,9 @@ -name: Build documentation +name: Build and Deploy Documentation on: push: + branches: + - main workflow_dispatch: env: @@ -11,48 +13,46 @@ env: jobs: build: runs-on: ubuntu-latest - outputs: - algolia_artifact: ${{ steps.define-ids.outputs.algolia_artifact }} - artifact: ${{ steps.define-ids.outputs.artifact }} steps: - name: Checkout repository uses: actions/checkout@v4 with: fetch-depth: 0 - - name: Define instance id and artifacts + - name: Define instance ID and artifacts id: define-ids run: | INSTANCE=${INSTANCE#*/} INSTANCE_ID_UPPER=$(echo "$INSTANCE" | tr '[:lower:]' '[:upper:]') ARTIFACT="starlasu-documentation-${INSTANCE_ID_UPPER}.zip" - ALGOLIA_ARTIFACT="algolia-indexes-${INSTANCE_ID_UPPER}.zip" - # Print the values - echo "INSTANCE_ID_UPPER: $INSTANCE_ID_UPPER" - echo "ARTIFACT: $ARTIFACT" - echo "ALGOLIA_ARTIFACT: $ALGOLIA_ARTIFACT" - - # Set the environment variables and outputs + # Set environment variables and outputs echo "INSTANCE_ID_UPPER=$INSTANCE_ID_UPPER" >> $GITHUB_ENV echo "ARTIFACT=$ARTIFACT" >> $GITHUB_ENV - echo "ALGOLIA_ARTIFACT=$ALGOLIA_ARTIFACT" >> $GITHUB_ENV echo "artifact=$ARTIFACT" >> $GITHUB_OUTPUT - echo "algolia_artifact=$ALGOLIA_ARTIFACT" >> $GITHUB_OUTPUT - - - name: Build docs using Writerside Docker builder - uses: JetBrains/writerside-github-action@v4 - with: - instance: ${{ env.INSTANCE }} - artifact: ${{ env.ARTIFACT }} - docker-version: ${{ env.DOCKER_VERSION }} - - name: Save artifact with build results + - name: Build documentation using Writerside Docker builder + run: | + mkdir -p artifacts + docker run --rm \ + -v "$PWD:/project" \ + -w "/project" \ + jetbrains/writerside-builder:${DOCKER_VERSION} \ + build --instance "${INSTANCE}" --output "artifacts/${ARTIFACT}" + + - name: Upload build artifact uses: actions/upload-artifact@v4 with: - name: docs - path: | - artifacts/${{ env.ARTIFACT }} - artifacts/report.json - artifacts/${{ env.ALGOLIA_ARTIFACT }} - retention-days: 7 \ No newline at end of file + name: writerside-docs + path: artifacts/ + + - name: Push built documentation as a package + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + # Create a release version tag + RELEASE_TAG="v$(date +'%Y%m%d%H%M%S')" + echo "Release tag: $RELEASE_TAG" + + # Package the built artifact and upload it to GitHub Packages + mkdir -p ./package From 0c0c20d2e57f93e20998246339dfcbce5b418936 Mon Sep 17 00:00:00 2001 From: Federico Tomassetti Date: Mon, 20 Jan 2025 17:39:19 +0100 Subject: [PATCH 02/11] updadate --- .github/workflows/build-documentation.yml | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/.github/workflows/build-documentation.yml b/.github/workflows/build-documentation.yml index b4db9a8..19cc5c1 100644 --- a/.github/workflows/build-documentation.yml +++ b/.github/workflows/build-documentation.yml @@ -19,26 +19,14 @@ jobs: with: fetch-depth: 0 - - name: Define instance ID and artifacts - id: define-ids - run: | - INSTANCE=${INSTANCE#*/} - INSTANCE_ID_UPPER=$(echo "$INSTANCE" | tr '[:lower:]' '[:upper:]') - ARTIFACT="starlasu-documentation-${INSTANCE_ID_UPPER}.zip" - - # Set environment variables and outputs - echo "INSTANCE_ID_UPPER=$INSTANCE_ID_UPPER" >> $GITHUB_ENV - echo "ARTIFACT=$ARTIFACT" >> $GITHUB_ENV - echo "artifact=$ARTIFACT" >> $GITHUB_OUTPUT - - name: Build documentation using Writerside Docker builder run: | mkdir -p artifacts docker run --rm \ -v "$PWD:/project" \ - -w "/project" \ + -w /project \ jetbrains/writerside-builder:${DOCKER_VERSION} \ - build --instance "${INSTANCE}" --output "artifacts/${ARTIFACT}" + /writerside/build.sh --input . --output artifacts - name: Upload build artifact uses: actions/upload-artifact@v4 From 20765eb476256b9de06ec940956e6ed331ef3eb3 Mon Sep 17 00:00:00 2001 From: Federico Tomassetti Date: Mon, 20 Jan 2025 17:44:35 +0100 Subject: [PATCH 03/11] updadate --- .github/workflows/build-documentation.yml | 55 +++++++++++++++++------ 1 file changed, 42 insertions(+), 13 deletions(-) diff --git a/.github/workflows/build-documentation.yml b/.github/workflows/build-documentation.yml index 19cc5c1..c08ad2d 100644 --- a/.github/workflows/build-documentation.yml +++ b/.github/workflows/build-documentation.yml @@ -13,20 +13,49 @@ env: jobs: build: runs-on: ubuntu-latest + outputs: + algolia_artifact: ${{ steps.define-ids.outputs.algolia_artifact }} + artifact: ${{ steps.define-ids.outputs.artifact }} steps: - name: Checkout repository uses: actions/checkout@v4 with: fetch-depth: 0 - - - name: Build documentation using Writerside Docker builder + - name: Define instance id and artifacts + id: define-ids run: | - mkdir -p artifacts - docker run --rm \ - -v "$PWD:/project" \ - -w /project \ - jetbrains/writerside-builder:${DOCKER_VERSION} \ - /writerside/build.sh --input . --output artifacts + INSTANCE=${INSTANCE#*/} + INSTANCE_ID_UPPER=$(echo "$INSTANCE" | tr '[:lower:]' '[:upper:]') + ARTIFACT="webHelp${INSTANCE_ID_UPPER}2-all.zip" + ALGOLIA_ARTIFACT="algolia-indexes-${INSTANCE_ID_UPPER}.zip" + + # Print the values + echo "INSTANCE_ID_UPPER: $INSTANCE_ID_UPPER" + echo "ARTIFACT: $ARTIFACT" + echo "ALGOLIA_ARTIFACT: $ALGOLIA_ARTIFACT" + + # Set the environment variables and outputs + echo "INSTANCE_ID_UPPER=$INSTANCE_ID_UPPER" >> $GITHUB_ENV + echo "ARTIFACT=$ARTIFACT" >> $GITHUB_ENV + echo "ALGOLIA_ARTIFACT=$ALGOLIA_ARTIFACT" >> $GITHUB_ENV + echo "artifact=$ARTIFACT" >> $GITHUB_OUTPUT + echo "algolia_artifact=$ALGOLIA_ARTIFACT" >> $GITHUB_OUTPUT + + - name: Build docs using Writerside Docker builder + uses: JetBrains/writerside-github-action@v4 + with: + instance: ${{ env.INSTANCE }} + docker-version: ${{ env.DOCKER_VERSION }} + + - name: Save artifact with build results + uses: actions/upload-artifact@v4 + with: + name: docs + path: | + artifacts/${{ steps.define-ids.outputs.artifact }} + artifacts/report.json + artifacts/${{ steps.define-ids.outputs.algolia_artifact }} + retention-days: 7 - name: Upload build artifact uses: actions/upload-artifact@v4 @@ -38,9 +67,9 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - # Create a release version tag - RELEASE_TAG="v$(date +'%Y%m%d%H%M%S')" - echo "Release tag: $RELEASE_TAG" + # Create a release version tag + RELEASE_TAG="v$(date +'%Y%m%d%H%M%S')" + echo "Release tag: $RELEASE_TAG" - # Package the built artifact and upload it to GitHub Packages - mkdir -p ./package + # Package the built artifact and upload it to GitHub Packages + mkdir -p ./package From aadf347fd9426ca2f01ab8362a3a04b657547905 Mon Sep 17 00:00:00 2001 From: Federico Tomassetti Date: Mon, 20 Jan 2025 17:54:08 +0100 Subject: [PATCH 04/11] fix broken links --- Writerside/strumenta.tree | 1 + Writerside/topics/TypeChecking.md | 3 +++ Writerside/topics/usecases/building-parser.md | 6 +++--- 3 files changed, 7 insertions(+), 3 deletions(-) create mode 100644 Writerside/topics/TypeChecking.md diff --git a/Writerside/strumenta.tree b/Writerside/strumenta.tree index ba14d2b..08c642a 100644 --- a/Writerside/strumenta.tree +++ b/Writerside/strumenta.tree @@ -29,6 +29,7 @@ + diff --git a/Writerside/topics/TypeChecking.md b/Writerside/topics/TypeChecking.md new file mode 100644 index 0000000..54b47c9 --- /dev/null +++ b/Writerside/topics/TypeChecking.md @@ -0,0 +1,3 @@ +# Type Checking + +_To be written_. \ No newline at end of file diff --git a/Writerside/topics/usecases/building-parser.md b/Writerside/topics/usecases/building-parser.md index f674d8d..4fd3575 100644 --- a/Writerside/topics/usecases/building-parser.md +++ b/Writerside/topics/usecases/building-parser.md @@ -12,10 +12,10 @@ An initial version may also be generated from the ANTLR grammar, by using StarLa We then organize the parser into a pipeline: 1. First-stage parsing using ANTLR. We obtain a parse tree and, possibly, a series of errors. -2. Second-stage parsing. [The parse tree is mapped into the AST](../parsetree_to_ast.md) +2. Second-stage parsing. [The parse tree is mapped into the AST](ParseTreeToASTMapping.md) 3. Potentially, for some parsers, we perform additional steps, such as: - 1. [Symbol resolution](../symbol_resolution.md) - 2. [Type checking](../typesystem.md) + 1. [Symbol resolution](SymbolResolution.md) + 2. [Type checking](TypeChecking.md) 3. Advanced calculations such as lineage, data flow analysis, linting, etc. The StarLasu ASTs provide a more convenient API with respect to the ANTLR APIs for parse trees. In fact, StarLasu comes From 9e51776e784cc5f4e7f2797dfec1f0e4be6b28e2 Mon Sep 17 00:00:00 2001 From: Federico Tomassetti Date: Mon, 20 Jan 2025 17:58:04 +0100 Subject: [PATCH 05/11] publish to netlify --- .github/workflows/build-documentation.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.github/workflows/build-documentation.yml b/.github/workflows/build-documentation.yml index c08ad2d..84b8f17 100644 --- a/.github/workflows/build-documentation.yml +++ b/.github/workflows/build-documentation.yml @@ -73,3 +73,14 @@ jobs: # Package the built artifact and upload it to GitHub Packages mkdir -p ./package + + - name: Deploy to Netlify + env: + NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} + NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} + run: | + # Install Netlify CLI + npm install -g netlify-cli + + # Deploy built documentation + netlify deploy --prod --dir artifacts \ No newline at end of file From 40decc5606d395acb43768856c9e61fb763eec48 Mon Sep 17 00:00:00 2001 From: Federico Tomassetti Date: Mon, 20 Jan 2025 18:03:45 +0100 Subject: [PATCH 06/11] publish to netlify --- .github/workflows/build-documentation.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-documentation.yml b/.github/workflows/build-documentation.yml index 84b8f17..d50b4e1 100644 --- a/.github/workflows/build-documentation.yml +++ b/.github/workflows/build-documentation.yml @@ -82,5 +82,9 @@ jobs: # Install Netlify CLI npm install -g netlify-cli - # Deploy built documentation - netlify deploy --prod --dir artifacts \ No newline at end of file + # Unzip the generated artifact + mkdir -p extracted + unzip artifacts/${{ env.ARTIFACT }} -d extracted + + # Deploy extracted content to Netlify + netlify deploy --prod --dir extracted \ No newline at end of file From 0314cc8ef3b9b9dcdc886661aa414112666ff410 Mon Sep 17 00:00:00 2001 From: Federico Tomassetti Date: Mon, 20 Jan 2025 18:07:17 +0100 Subject: [PATCH 07/11] disable the publication of the github package --- .github/workflows/build-documentation.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build-documentation.yml b/.github/workflows/build-documentation.yml index d50b4e1..6b3668d 100644 --- a/.github/workflows/build-documentation.yml +++ b/.github/workflows/build-documentation.yml @@ -63,16 +63,16 @@ jobs: name: writerside-docs path: artifacts/ - - name: Push built documentation as a package - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - # Create a release version tag - RELEASE_TAG="v$(date +'%Y%m%d%H%M%S')" - echo "Release tag: $RELEASE_TAG" - - # Package the built artifact and upload it to GitHub Packages - mkdir -p ./package +# - name: Push built documentation as a package +# env: +# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} +# run: | +# # Create a release version tag +# RELEASE_TAG="v$(date +'%Y%m%d%H%M%S')" +# echo "Release tag: $RELEASE_TAG" +# +# # Package the built artifact and upload it to GitHub Packages +# mkdir -p ./package - name: Deploy to Netlify env: From c512c2cf5cf6003bb9771c480102873735a0d4bd Mon Sep 17 00:00:00 2001 From: Federico Tomassetti Date: Mon, 20 Jan 2025 18:08:37 +0100 Subject: [PATCH 08/11] revisit the publication of the github package --- .github/workflows/build-documentation.yml | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build-documentation.yml b/.github/workflows/build-documentation.yml index 6b3668d..236b05e 100644 --- a/.github/workflows/build-documentation.yml +++ b/.github/workflows/build-documentation.yml @@ -63,16 +63,18 @@ jobs: name: writerside-docs path: artifacts/ -# - name: Push built documentation as a package -# env: -# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} -# run: | -# # Create a release version tag -# RELEASE_TAG="v$(date +'%Y%m%d%H%M%S')" -# echo "Release tag: $RELEASE_TAG" -# -# # Package the built artifact and upload it to GitHub Packages -# mkdir -p ./package + - name: Package Built Artifact + run: | + mkdir -p ./package + cp artifacts/webHelpSTRUMENTA2-all.zip ./package/ + cd ./package + echo '{ "name": "writerside-docs", "version": "1.0.0" }' > package.json + + - name: Publish to GitHub Packages + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + npm publish --registry=https://npm.pkg.github.com - name: Deploy to Netlify env: From 82585a79029c4224779c6a9a3e6d77ef9c743af8 Mon Sep 17 00:00:00 2001 From: Federico Tomassetti Date: Tue, 21 Jan 2025 12:47:55 +0100 Subject: [PATCH 09/11] stop publishing GitHub package --- .github/workflows/build-documentation.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.github/workflows/build-documentation.yml b/.github/workflows/build-documentation.yml index 236b05e..8234792 100644 --- a/.github/workflows/build-documentation.yml +++ b/.github/workflows/build-documentation.yml @@ -70,12 +70,6 @@ jobs: cd ./package echo '{ "name": "writerside-docs", "version": "1.0.0" }' > package.json - - name: Publish to GitHub Packages - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - npm publish --registry=https://npm.pkg.github.com - - name: Deploy to Netlify env: NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} From 0025354a497fed8eb85731d8322cfa9a328bc078 Mon Sep 17 00:00:00 2001 From: Federico Tomassetti Date: Tue, 21 Jan 2025 12:52:26 +0100 Subject: [PATCH 10/11] publish release --- .github/workflows/build-documentation.yml | 56 +++++++++++++++++------ 1 file changed, 43 insertions(+), 13 deletions(-) diff --git a/.github/workflows/build-documentation.yml b/.github/workflows/build-documentation.yml index 8234792..876dbd4 100644 --- a/.github/workflows/build-documentation.yml +++ b/.github/workflows/build-documentation.yml @@ -57,18 +57,18 @@ jobs: artifacts/${{ steps.define-ids.outputs.algolia_artifact }} retention-days: 7 - - name: Upload build artifact - uses: actions/upload-artifact@v4 - with: - name: writerside-docs - path: artifacts/ - - - name: Package Built Artifact - run: | - mkdir -p ./package - cp artifacts/webHelpSTRUMENTA2-all.zip ./package/ - cd ./package - echo '{ "name": "writerside-docs", "version": "1.0.0" }' > package.json +# - name: Upload build artifact +# uses: actions/upload-artifact@v4 +# with: +# name: writerside-docs +# path: artifacts/ +# +# - name: Package Built Artifact +# run: | +# mkdir -p ./package +# cp artifacts/webHelpSTRUMENTA2-all.zip ./package/ +# cd ./package +# echo '{ "name": "writerside-docs", "version": "1.0.0" }' > package.json - name: Deploy to Netlify env: @@ -83,4 +83,34 @@ jobs: unzip artifacts/${{ env.ARTIFACT }} -d extracted # Deploy extracted content to Netlify - netlify deploy --prod --dir extracted \ No newline at end of file + netlify deploy --prod --dir extracted + + - name: Create Release + id: create-release + uses: actions/create-release@v1 + with: + tag_name: v${{ github.run_number }} + release_name: Documentation Build - ${{ github.run_number }} + body: | + ## Documentation Build + This release contains the built documentation artifacts for version ${{ github.run_number }}. + draft: false + prerelease: false + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Upload Artifact to Release + uses: actions/upload-release-asset@v1 + with: + upload_url: ${{ steps.create-release.outputs.upload_url }} + asset_path: artifacts/${{ env.ARTIFACT }} + asset_name: ${{ env.ARTIFACT }} + asset_content_type: application/zip + + - name: Upload Algolia Artifact to Release + uses: actions/upload-release-asset@v1 + with: + upload_url: ${{ steps.create-release.outputs.upload_url }} + asset_path: artifacts/${{ env.ALGOLIA_ARTIFACT }} + asset_name: ${{ env.ALGOLIA_ARTIFACT }} + asset_content_type: application/zip \ No newline at end of file From ae544209e0fca2ea7fa6e2084368525a7794334b Mon Sep 17 00:00:00 2001 From: Federico Tomassetti Date: Tue, 21 Jan 2025 12:58:16 +0100 Subject: [PATCH 11/11] publish release --- .github/workflows/build-documentation.yml | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build-documentation.yml b/.github/workflows/build-documentation.yml index 876dbd4..348ccb8 100644 --- a/.github/workflows/build-documentation.yml +++ b/.github/workflows/build-documentation.yml @@ -99,18 +99,17 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Install GitHub CLI + run: sudo apt-get install -y gh + - name: Upload Artifact to Release - uses: actions/upload-release-asset@v1 - with: - upload_url: ${{ steps.create-release.outputs.upload_url }} - asset_path: artifacts/${{ env.ARTIFACT }} - asset_name: ${{ env.ARTIFACT }} - asset_content_type: application/zip + run: | + gh release upload v${{ github.run_number }} artifacts/${{ env.ARTIFACT }} --clobber + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Upload Algolia Artifact to Release - uses: actions/upload-release-asset@v1 - with: - upload_url: ${{ steps.create-release.outputs.upload_url }} - asset_path: artifacts/${{ env.ALGOLIA_ARTIFACT }} - asset_name: ${{ env.ALGOLIA_ARTIFACT }} - asset_content_type: application/zip \ No newline at end of file + run: | + gh release upload v${{ github.run_number }} artifacts/${{ env.ALGOLIA_ARTIFACT }} --clobber + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file