Skip to content

# Flow diagram for npm.yml jobs and steps publishes a meta @foundry-rs/forge package once all per-arch #92

@Dargon789

Description

@Dargon789

Reviewer's Guide

Adds a new GitHub Actions workflow (npm.yml) that, after a successful release or a manual trigger, downloads per-platform Foundry artifacts, stages them into per-OS/arch scoped NPM packages using Bun scripts, publishes those packages to npm with provenance, then publishes a meta @foundry-rs/forge package once all per-arch publishes complete.

Flow diagram for npm.yml jobs and steps

flowchart TD
  Start["Start npm.yml workflow"]

  subgraph Trigger_Condition["Trigger condition"]
    T1["Event workflow_run with conclusion success"]
    T2["Event workflow_dispatch with non-empty run_id"]
  end

  Start --> Trigger_Condition
  Trigger_Condition -->|"condition met"| J_publish_arch

  subgraph J_publish_arch["Job publish-arch (matrix per os/arch)"]
    direction TB
    S1_checkout["Checkout repository"]
    S2_prep_dir["Prepare temp artifact directory"]
    S3_download_artifacts["Download foundry_* artifacts (download-artifact)"]
    S4_setup_bun["Setup Bun"]
    S5_setup_node["Setup Node for npm auth"]
    S6_install_deps["bun install --frozen-lockfile in ./npm"]
    S7_build_ts["Transpile TS to JS (bun run build)"]
    S8_release_version["Derive RELEASE_VERSION from artifact filenames"]
    S9_stage_binary["Stage platform binary into @foundry-rs/forge-os-arch package"]
    S10_sanity_check["Sanity check staged binary (exists, executable)"]
    S11_publish_arch["Publish per-arch package via bun scripts/publish.ts"]

    S1_checkout --> S2_prep_dir --> S3_download_artifacts --> S4_setup_bun --> S5_setup_node --> S6_install_deps --> S7_build_ts --> S8_release_version --> S9_stage_binary --> S10_sanity_check --> S11_publish_arch
  end

  J_publish_arch --> J_publish_meta

  subgraph J_publish_meta["Job publish-meta (needs publish-arch)"]
    direction TB
    M1_checkout["Checkout repository"]
    M2_setup_bun["Setup Bun"]
    M3_setup_node["Setup Node for npm auth"]
    M4_install_deps["bun install --frozen-lockfile in ./npm"]
    M5_build_ts["Transpile TS to JS (bun run build)"]
    M6_publish_meta["Publish meta @foundry-rs/forge with RELEASE_VERSION"]

    M1_checkout --> M2_setup_bun --> M3_setup_node --> M4_install_deps --> M5_build_ts --> M6_publish_meta
  end

  J_publish_meta --> End["End npm.yml workflow"]
Loading

File-Level Changes

Change Details Files
Introduce a multi-job GitHub Actions workflow to build, stage, and publish per-OS/arch forge NPM packages and a meta package tied to release artifacts.
  • Define workflow triggers for successful completion of the existing release workflow or manual dispatch with an optional run_id, plus concurrency control and default shell/env
  • Create a publish-arch matrix job over OS/arch combinations that checks out code, downloads foundry_* artifacts from the triggering release run, installs Bun and Node, installs npm package dependencies, and builds the npm project
  • Derive the RELEASE_VERSION from the downloaded artifact filenames and expose it as a job output for downstream jobs
  • Extract and stage the correct forge binary for each OS/arch into a scoped package using a Bun prepublish script, with handling for both .zip and .tar.gz artifacts and Windows vs non-Windows binaries
  • Sanity-check that the staged binary exists (and is executable where applicable) before publishing each per-arch package to npm with NPM_TOKEN-based auth and provenance enabled
  • Add a dependent publish-meta job that re-installs/builds the npm project after publish-arch completes, then publishes the meta @foundry-rs/forge package using the shared RELEASE_VERSION and npm auth configuration
.github/workflows/npm.yml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Originally posted by @sourcery-ai[bot] in #91 (comment)

Metadata

Metadata

Assignees

Labels

Projects

Status

In Review

Status

Todo

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions