Skip to content

Commit

Permalink
ci: also commit generated js pkgs
Browse files Browse the repository at this point in the history
  • Loading branch information
RubixDev committed Mar 4, 2025
1 parent fba8dce commit 4650b52
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 7 deletions.
14 changes: 11 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ jobs:

- name: Restore Cache
uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true

- name: Run Codegen
run: cargo xtask codegen
Expand Down Expand Up @@ -63,6 +65,8 @@ jobs:

- name: Restore Cache
uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true

- name: Run Codegen
run: cargo xtask codegen
Expand Down Expand Up @@ -120,15 +124,18 @@ jobs:

- name: Restore Cache
uses: Swatinem/rust-cache@v2

- name: Create SVGs
run: cargo xtask codegen queries && cargo xtask theme-svgs
with:
cache-on-failure: true

- name: Generate Code
run: cargo xtask codegen

- name: Create SVGs
run: cargo xtask theme-svgs

- name: Update Vite Example
run: cargo xtask update-vite-example
continue-on-error: true

- name: Commit changes
uses: EndBug/add-and-commit@v9
Expand All @@ -138,6 +145,7 @@ jobs:
syntastica-parsers-gitdep/Cargo.toml syntastica-parsers*/README.md
syntastica-js/src/index.ts syntastica-themes/assets/theme-svgs
syntastica-themes/theme_list.md examples/wasm/vite/package*.json
syntastica-js/langs
committer_name: github-actions[bot]
committer_email: 41898282+github-actions[bot]@users.noreply.github.com
message: 'chore: run codegen'
Expand Down
7 changes: 5 additions & 2 deletions xtask/src/build_js_langs.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::process::Command;

use anyhow::Result;
use anyhow::{bail, Result};

pub fn run() -> Result<()> {
let langs_dir = crate::WORKSPACE_DIR.join("syntastica-js/langs");
Expand All @@ -9,10 +9,13 @@ pub fn run() -> Result<()> {
if !entry.file_type()?.is_dir() {
continue;
}
Command::new("npm")
let status = Command::new("npm")
.current_dir(entry.path())
.args(["run", "build"])
.status()?;
if !status.success() {
bail!("npm exited with non-zero exit code: {status}");
}
}

Ok(())
Expand Down
7 changes: 5 additions & 2 deletions xtask/src/update_vite_example.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::process::Command;

use anyhow::Result;
use anyhow::{bail, Result};

pub fn run() -> Result<()> {
let langs = crate::LANGUAGE_CONFIG
Expand All @@ -10,11 +10,14 @@ pub fn run() -> Result<()> {
.map(|lang| &lang.name)
.collect::<Vec<_>>();
let demo_dir = crate::WORKSPACE_DIR.join("examples/wasm/vite");
Command::new("npm")
let status = Command::new("npm")
.current_dir(&demo_dir)
.arg("install")
.args(langs.iter().map(|lang| format!("@syntastica/lang-{lang}")))
.status()?;
if !status.success() {
bail!("npm exited with non-zero exit code: {status}");
}

Ok(())
}

0 comments on commit 4650b52

Please sign in to comment.