Skip to content

CI: Linting and Formatting for Rust and Typescript #45

CI: Linting and Formatting for Rust and Typescript

CI: Linting and Formatting for Rust and Typescript #45

Workflow file for this run

name: deploy
on:
push:
branches:
- main
pull_request:
env:
BRANCH_NAME: ${{ github.ref_name }}
permissions:
pull-requests: write
jobs:
build_frontend:
name: Build Frontend
runs-on: ubuntu-latest
steps:
- name: Repository Checkout
uses: actions/checkout@v4
- name: Setup NodeJS
uses: actions/setup-node@v4
with:
node-version: 20
cache: "npm"
cache-dependency-path: frontend/package-lock.json
- name: Setup Rust
run: |
rustup toolchain install stable
rustup target add wasm32-unknown-unknown
- name: Build
run: |
cd frontend
npm install
npm run build
- name: Upload
uses: actions/upload-artifact@v4
with:
name: app
path: frontend/dist
- name: Build Docs
run: |
cd frontend
npx typedoc --entryPointStrategy expand ./src
- name: Upload
uses: actions/upload-artifact@v4
with:
name: frontend_docs
path: frontend/docs
build_catlog_docs:
name: Build Catlog Docs
runs-on: ubuntu-latest
steps:
- name: Repository Checkout
uses: actions/checkout@v4
- name: Setup Rust
run: |
rustup toolchain install stable
- name: Build
run: |
cd catlog
cargo doc
- name: Upload Frontend Docs
uses: actions/upload-artifact@v4
with:
name: catlog_docs
path: catlog/target/doc
build_dev-docs:
name: Build dev-docs
runs-on: ubuntu-latest
steps:
- name: Repository Checkout
uses: actions/checkout@v4
- name: Setup TinyTeX
uses: r-lib/actions/setup-tinytex@v2
- name: Install TeX Packages
run: |
tlmgr update --self
tlmgr install dvisvgm
tlmgr install standalone
tlmgr install pgf
tlmgr install tikz-cd
tlmgr install amsmath
- name: Build
run: |
cd dev-docs
bash ci-build.sh
- name: Upload
uses: actions/upload-artifact@v4
with:
name: dev-docs
path: dev-docs/output
deploy:
name: Deploy to netlify
runs-on: ubuntu-latest
needs: [build_dev-docs, build_frontend, build_catlog_docs]
steps:
- name: Repository Checkout
uses: actions/checkout@v4
- name: Setup NodeJS
uses: actions/setup-node@v4
with:
node-version: 20
cache: "npm"
cache-dependency-path: netlify-env/package-lock.json
- name: Install Netlify
run: |
cd netlify-env
npm install
- name: Download artifacts
uses: actions/download-artifact@v4
- name: Consolidate
run: |
mv app site/
mv dev-docs site/dev
mv catlog_docs site/dev/catlog
mv frontend_docs site/dev/frontend
echo "/dev /dev/index.xml" > site/_redirects
- name: Deploy
id: netlify_deploy
run: |
cd netlify-env
prod_flag=""
if [ "$BRANCH_NAME" = "main" ]; then prod_flag="--prod"; fi
npx netlify deploy --dir ../site --site ${{ secrets.NETLIFY_SITE_ID }} --auth ${{ secrets.NETLIFY_API_TOKEN }} $prod_flag --json > ../deploy_output.json
- name: Generate URL Preview
id: url_preview
if: ${{ env.BRANCH_NAME != 'main' }}
run: |
NETLIFY_PREVIEW_URL=$(jq -r '.deploy_url' deploy_output.json)
echo "NETLIFY_PREVIEW_URL=$NETLIFY_PREVIEW_URL" >> "$GITHUB_OUTPUT"
- name: Comment URL Preview on PR
uses: mshick/add-pr-comment@v2
if: ${{ env.BRANCH_NAME != 'main' }}
with:
message: |
Preview url: ${{ steps.url_preview.outputs.NETLIFY_PREVIEW_URL }}