Publish npm package from GitHub Actions
This commit is contained in:
@@ -278,14 +278,43 @@ jobs:
|
|||||||
|
|
||||||
gh release create "${{ needs.plan.outputs.tag }}" --target "$RELEASE_COMMIT" $PRERELEASE_FLAG --title "$ANNOUNCEMENT_TITLE" --notes-file "$RUNNER_TEMP/notes.txt" artifacts/*
|
gh release create "${{ needs.plan.outputs.tag }}" --target "$RELEASE_COMMIT" $PRERELEASE_FLAG --title "$ANNOUNCEMENT_TITLE" --notes-file "$RUNNER_TEMP/notes.txt" artifacts/*
|
||||||
|
|
||||||
|
publish-npm:
|
||||||
|
needs:
|
||||||
|
- plan
|
||||||
|
- host
|
||||||
|
runs-on: "ubuntu-22.04"
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
PLAN: ${{ needs.plan.outputs.val }}
|
||||||
|
if: ${{ !fromJson(needs.plan.outputs.val).announcement_is_prerelease || fromJson(needs.plan.outputs.val).publish_prereleases }}
|
||||||
|
steps:
|
||||||
|
- name: Fetch npm packages
|
||||||
|
uses: actions/download-artifact@v7
|
||||||
|
with:
|
||||||
|
pattern: artifacts-*
|
||||||
|
path: npm/
|
||||||
|
merge-multiple: true
|
||||||
|
- uses: actions/setup-node@v6
|
||||||
|
with:
|
||||||
|
node-version: '20.x'
|
||||||
|
registry-url: 'https://registry.npmjs.org'
|
||||||
|
- run: |
|
||||||
|
for release in $(echo "$PLAN" | jq --compact-output '.releases[] | select([.artifacts[] | endswith("-npm-package.tar.gz")] | any)'); do
|
||||||
|
pkg=$(echo "$release" | jq '.artifacts[] | select(endswith("-npm-package.tar.gz"))' --raw-output)
|
||||||
|
npm publish --access public "./npm/${pkg}"
|
||||||
|
done
|
||||||
|
env:
|
||||||
|
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||||
|
|
||||||
announce:
|
announce:
|
||||||
needs:
|
needs:
|
||||||
- plan
|
- plan
|
||||||
- host
|
- host
|
||||||
|
- publish-npm
|
||||||
# use "always() && ..." to allow us to wait for all publish jobs while
|
# use "always() && ..." to allow us to wait for all publish jobs while
|
||||||
# still allowing individual publish jobs to skip themselves (for prereleases).
|
# still allowing individual publish jobs to skip themselves (for prereleases).
|
||||||
# "host" however must run to completion, no skipping allowed!
|
# "host" however must run to completion, no skipping allowed!
|
||||||
if: ${{ always() && needs.host.result == 'success' }}
|
if: ${{ always() && needs.host.result == 'success' && (needs.publish-npm.result == 'skipped' || needs.publish-npm.result == 'success') }}
|
||||||
runs-on: "ubuntu-22.04"
|
runs-on: "ubuntu-22.04"
|
||||||
env:
|
env:
|
||||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|||||||
+2
-2
@@ -4,8 +4,8 @@ version = "0.1.2"
|
|||||||
edition = "2024"
|
edition = "2024"
|
||||||
authors = ["Austin"]
|
authors = ["Austin"]
|
||||||
description = "A terminal UI launcher for terminal UI apps"
|
description = "A terminal UI launcher for terminal UI apps"
|
||||||
repository = "https://github.com/therobustroast/tui2"
|
repository = "https://github.com/auggie2lbcf/tui2"
|
||||||
homepage = "https://github.com/therobustroast/tui2"
|
homepage = "https://github.com/auggie2lbcf/tui2"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
|
|
||||||
|
|||||||
+4
-2
@@ -9,13 +9,15 @@ cargo-dist-version = "0.31.0"
|
|||||||
ci = "github"
|
ci = "github"
|
||||||
# The installers to generate for each app
|
# The installers to generate for each app
|
||||||
installers = ["shell", "powershell", "npm", "homebrew"]
|
installers = ["shell", "powershell", "npm", "homebrew"]
|
||||||
|
# A namespace to use when publishing this package to the npm registry
|
||||||
|
npm-scope = "@auggie2lbcf"
|
||||||
# A GitHub repo to push Homebrew formulas to
|
# A GitHub repo to push Homebrew formulas to
|
||||||
tap = "therobustroast/tui2"
|
tap = "auggie2lbcf/tui2"
|
||||||
# Target platforms to build apps for (Rust target-triple syntax)
|
# Target platforms to build apps for (Rust target-triple syntax)
|
||||||
targets = ["aarch64-apple-darwin", "aarch64-unknown-linux-gnu", "aarch64-pc-windows-msvc", "x86_64-apple-darwin", "x86_64-unknown-linux-gnu", "x86_64-unknown-linux-musl", "x86_64-pc-windows-msvc"]
|
targets = ["aarch64-apple-darwin", "aarch64-unknown-linux-gnu", "aarch64-pc-windows-msvc", "x86_64-apple-darwin", "x86_64-unknown-linux-gnu", "x86_64-unknown-linux-musl", "x86_64-pc-windows-msvc"]
|
||||||
# Path that installers should place binaries in
|
# Path that installers should place binaries in
|
||||||
install-path = "CARGO_HOME"
|
install-path = "CARGO_HOME"
|
||||||
# Publish jobs to run in CI
|
# Publish jobs to run in CI
|
||||||
publish-jobs = []
|
publish-jobs = ["npm"]
|
||||||
# Whether to install an updater program
|
# Whether to install an updater program
|
||||||
install-updater = false
|
install-updater = false
|
||||||
|
|||||||
Reference in New Issue
Block a user