Skip to content

Commit

Permalink
Merge pull request #38 from Strumenta/chore/autodeploy
Browse files Browse the repository at this point in the history
Update publication workflow
  • Loading branch information
ftomassetti authored Jan 21, 2025
2 parents 8a17f7e + ae54420 commit 4a5b9c8
Show file tree
Hide file tree
Showing 4 changed files with 86 additions and 25 deletions.
101 changes: 79 additions & 22 deletions .github/workflows/build-documentation.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
name: Build documentation
name: Build and Deploy Documentation

on:
push:
branches:
- main
workflow_dispatch:

env:
Expand All @@ -19,40 +21,95 @@ jobs:
uses: actions/checkout@v4
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"
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
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 }}
artifact: ${{ env.ARTIFACT }}
docker-version: ${{ env.DOCKER_VERSION }}

- name: Save artifact with build results
uses: actions/upload-artifact@v4
with:
name: docs
path: |
artifacts/${{ env.ARTIFACT }}
artifacts/${{ steps.define-ids.outputs.artifact }}
artifacts/report.json
artifacts/${{ env.ALGOLIA_ARTIFACT }}
retention-days: 7
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: 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
# Unzip the generated artifact
mkdir -p extracted
unzip artifacts/${{ env.ARTIFACT }} -d extracted
# Deploy extracted content to Netlify
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: Install GitHub CLI
run: sudo apt-get install -y gh

- name: Upload Artifact to Release
run: |
gh release upload v${{ github.run_number }} artifacts/${{ env.ARTIFACT }} --clobber
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Upload Algolia Artifact to Release
run: |
gh release upload v${{ github.run_number }} artifacts/${{ env.ALGOLIA_ARTIFACT }} --clobber
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions Writerside/strumenta.tree
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
<toc-element topic="ASTRepresentation.md"/>
<toc-element topic="Validation.md"/>
<toc-element topic="SymbolResolution.md"/>
<toc-element topic="TypeChecking.md"/>
</toc-element>
<toc-element topic="Methods.md">
<toc-element topic="ChiselMethod.md"/>
Expand Down
3 changes: 3 additions & 0 deletions Writerside/topics/TypeChecking.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Type Checking

_To be written_.
6 changes: 3 additions & 3 deletions Writerside/topics/usecases/building-parser.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 4a5b9c8

Please sign in to comment.