Skip to content

Commit dbebd16

Browse files
committed
feat: add npm installer and publish job for @schpet/linear-cli
1 parent 7ec58b0 commit dbebd16

2 files changed

Lines changed: 36 additions & 3 deletions

File tree

.github/workflows/release.yml

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,15 +330,44 @@ jobs:
330330
done
331331
git push
332332
333+
publish-npm:
334+
needs:
335+
- plan
336+
- host
337+
runs-on: "ubuntu-22.04"
338+
env:
339+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
340+
PLAN: ${{ needs.plan.outputs.val }}
341+
if: ${{ !fromJson(needs.plan.outputs.val).announcement_is_prerelease || fromJson(needs.plan.outputs.val).publish_prereleases }}
342+
steps:
343+
- name: Fetch npm packages
344+
uses: actions/download-artifact@v7
345+
with:
346+
pattern: artifacts-*
347+
path: npm/
348+
merge-multiple: true
349+
- uses: actions/setup-node@v6
350+
with:
351+
node-version: '20.x'
352+
registry-url: 'https://registry.npmjs.org'
353+
- run: |
354+
for release in $(echo "$PLAN" | jq --compact-output '.releases[] | select([.artifacts[] | endswith("-npm-package.tar.gz")] | any)'); do
355+
pkg=$(echo "$release" | jq '.artifacts[] | select(endswith("-npm-package.tar.gz"))' --raw-output)
356+
npm publish --access public "./npm/${pkg}"
357+
done
358+
env:
359+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
360+
333361
announce:
334362
needs:
335363
- plan
336364
- host
337365
- publish-homebrew-formula
366+
- publish-npm
338367
# use "always() && ..." to allow us to wait for all publish jobs while
339368
# still allowing individual publish jobs to skip themselves (for prereleases).
340369
# "host" however must run to completion, no skipping allowed!
341-
if: ${{ always() && needs.host.result == 'success' && (needs.publish-homebrew-formula.result == 'skipped' || needs.publish-homebrew-formula.result == 'success') }}
370+
if: ${{ always() && needs.host.result == 'success' && (needs.publish-homebrew-formula.result == 'skipped' || needs.publish-homebrew-formula.result == 'success') && (needs.publish-npm.result == 'skipped' || needs.publish-npm.result == 'success') }}
342371
runs-on: "ubuntu-22.04"
343372
env:
344373
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

dist-workspace.toml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,17 @@ cargo-dist-version = "0.31.0"
2323
# CI backends to support
2424
ci = "github"
2525
# The installers to generate for each app
26-
installers = ["shell", "homebrew"]
26+
installers = ["shell", "npm", "homebrew"]
2727
# A GitHub repo to push Homebrew formulas to
2828
tap = "schpet/homebrew-tap"
2929
# Target platforms to build apps for (Rust target-triple syntax)
3030
targets = ["aarch64-apple-darwin", "aarch64-unknown-linux-gnu", "x86_64-apple-darwin", "x86_64-unknown-linux-gnu", "x86_64-pc-windows-msvc"]
3131
# Publish jobs to run in CI
32-
publish-jobs = ["homebrew"]
32+
publish-jobs = ["homebrew", "npm"]
33+
# A namespace to use when publishing this package to the npm registry
34+
npm-scope = "@schpet"
35+
# The npm package should have this name
36+
npm-package = "linear-cli"
3337
# Which actions to run on pull requests
3438
# pr-run-mode = "upload"
3539
# https://opensource.axo.dev/cargo-dist/book/ci/customizing.html#customizing-build-setup

0 commit comments

Comments
 (0)