Skip to main contentSkip to docs navigation

Chassis

Publishing

View on GitHub

Release a version of a repository of icons by a push to main with a new version and its changelog entry, as a package on npm or as a tag and archives.

Introduction

A repository of icons is released as a version: a package on npm with the output for the web, and a GitHub release with the archives of the output for the web and for each target. The repository does not commit the output: the release workflow that chassis-icons init wrote into it, .github/workflows/release.yml, builds the output from the commit of the version. The workflow names no package. It releases what package.json of the repository describes, so every set is released by its own repository, in the same way.

The commands of this page are the scripts that init wrote into package.json, run with npm run. In a repository made with --pm pnpm, run them with pnpm in place of npm run.

Prerequisites

A release needs a repository of icons on GitHub that passes its checks.

  • The source builds, and codepoints.json, README.md and package.json are what it builds: npm run verify passes.
  • name, version, description, repository and license of package.json are those of your set. init wrote them from its options and from the folder.
  • To publish to npm from the workflow, the package has a trusted publisher on npmjs.com that names your repository and the workflow file release.yml.
  • A set that is not published has "private": true in package.json. Its release is the tag, the GitHub release and the archives.

Describe a change

CHANGELOG.md is written by hand, in the form of Keep a Changelog. Each version has an entry under a heading of its own, and the text of the entry is the body of the GitHub release. Name the icons that the change adds, renames or removes. A removed or renamed icon breaks every project that draws it, so say it in the text.

MD
## [0.2.0]

### Added

- `bar-line`.

npm run release-notes prints the entry of the version that package.json names, without its heading, and fails without one. The workflow runs it first, so a version without an entry is not released.

Shell
npm run release-notes

Make a version

A version is one commit: the new version of package.json and its entry in CHANGELOG.md. The version needs no build: the release builds dist/ from that commit, with the new version in the headers of the stylesheets. Check the set before the commit:

Shell
npm run verify

Commit the version and its entry. CI, .github/workflows/ci.yml, runs on a pull request and on a push to main: the changelog entry, the source lint and verify.

Release

A release is the commit of a version, pushed to main. The push runs .github/workflows/release.yml, which reads package.json and stops when npm has the version and the tag v<version> exists. Otherwise it reads the changelog entry, lints the source, runs verify, builds dist/, writes the archives, and does what the manifest says.

Field of package.jsonWhat the workflow does
name, versionPublishes that package to npm, unless npm has the version, and creates the GitHub release v<version>, unless the tag exists
"private": truePublishes nothing. The release is the tag, the GitHub release and its archives
publishConfig.access"public" as init wrote it; "restricted" for a package that only your organization installs
publishConfig.provenancetrue for a signed statement of the commit and the workflow that built the version

The GitHub release has the changelog entry of the version as its text, and an archive per target attached:

ArchiveWhat it holds
<font>-web-<version>.zipThe output for the web, icons.json, svgs/ and web/, and the page of the set, preview/, which a reader opens without a build
<font>-ios-<version>.zipWith the ios target: the files of dist/ios/, the asset catalog and the Swift file, at its top level
<font>-android-<version>.zipWith the android target: the files of dist/android/, res/drawable/, at its top level

npm run archive writes the same archives to archives/ of the repository on your machine, from the dist/ of a build, a folder that .gitignore keeps out of the commits.

The archives of the targets are how an app takes a version of the set: the package on npm does not hold the files of iOS and Android. iOS and Android shows how an app adds them.

A version with a prerelease part, such as 0.2.0-next.0, goes to the npm dist-tag of its first identifier, next, and its GitHub release is marked as a prerelease. Every other version goes to latest.

The workflow publishes with npm trusted publishing and needs no npm token: the trusted publisher on npmjs.com is your repository and the file name release.yml. Renaming the file breaks publishing until the trusted publisher names the new file. A run that published and then failed can be run again from the Actions page: it skips what npm has, and creates the GitHub release alone.

What is published

The package holds the output for the web, dist/icons.json, dist/svgs/ and dist/web/, and nothing of the build. The files of dist/ios/ and dist/android/ and the page of the set, preview/, are not published. npm packs dist/ although .gitignore names it, because files names it. The build writes the fields of package.json that say so, from the font name of the configuration, and keeps an entry of files or exports that is not about the output, such as the CHANGELOG.md that init added. For the font acme-icons of the quick start it writes:

JSON
{
  "files": ["dist/icons.json", "dist/svgs", "dist/web", "CHANGELOG.md"],
  "main": "dist/web/acme-icons.css",
  "style": "dist/web/acme-icons.css",
  "sass": "dist/web/acme-icons.scss",
  "exports": {
    ".": {
      "sass": "./dist/web/acme-icons.scss",
      "style": "./dist/web/acme-icons.css",
      "default": "./dist/web/acme-icons.css"
    },
    "./dist/*": "./dist/*",
    "./package.json": "./package.json"
  },
  "sideEffects": ["*.css", "*.scss"]
}

exports says what a project can import. The package itself resolves to the stylesheet of the font, or to its Sass file for a tool that asks for the sass condition. ./dist/* is the files of the output under their paths, and ./package.json is the manifest. sideEffects tells a bundler to keep the stylesheets, which no module imports by name. README.md, which the build writes for your set with your package name, your font and your prefix in its examples, goes with every package. npm pack --dry-run lists what npm would publish.

Troubleshooting

Each entry gives the message or the symptom, then the cause and the fix.

Nothing is released

The workflow runs and stops in its first job, Detect Version. npm has the version and the tag exists, so there is nothing to release. Raise version in package.json, write its entry in CHANGELOG.md, and push the commit.

Version has no entry

The step Release notes of the workflow, or npm run release-notes, stops with CHANGELOG.md has no entry for <version>. Add it. when the version of package.json has no heading in the changelog, and with The entry of CHANGELOG.md for <version> is empty. when its heading has nothing under it. Write the entry and push again: nothing was published.

Committed file is stale

The step Verify the set stops with codepoints.json: changed. It is not what the source builds: run the build, and commit it., or the same for README.md or package.json. A file of source/ or the configuration changed without a build, so the committed file is older than the source. Run npm run build, commit the file, and push again: nothing was published.

Next steps

Continue with one of these pages: