Skip to content

Commit 60f314f

Browse files
committed
fix: sync action with dist
1 parent 2419bf6 commit 60f314f

2 files changed

Lines changed: 33 additions & 12 deletions

File tree

.github/workflows/release.yml

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,14 +278,43 @@ jobs:
278278
279279
gh release create "${{ needs.plan.outputs.tag }}" --target "$RELEASE_COMMIT" $PRERELEASE_FLAG --title "$ANNOUNCEMENT_TITLE" --notes-file "$RUNNER_TEMP/notes.txt" artifacts/*
280280
281+
publish-npm:
282+
needs:
283+
- plan
284+
- host
285+
runs-on: "ubuntu-22.04"
286+
env:
287+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
288+
PLAN: ${{ needs.plan.outputs.val }}
289+
if: ${{ !fromJson(needs.plan.outputs.val).announcement_is_prerelease || fromJson(needs.plan.outputs.val).publish_prereleases }}
290+
steps:
291+
- name: Fetch npm packages
292+
uses: actions/download-artifact@v4
293+
with:
294+
pattern: artifacts-*
295+
path: npm/
296+
merge-multiple: true
297+
- uses: actions/setup-node@v4
298+
with:
299+
node-version: '20.x'
300+
registry-url: 'https://registry.npmjs.org'
301+
- run: |
302+
for release in $(echo "$PLAN" | jq --compact-output '.releases[] | select([.artifacts[] | endswith("-npm-package.tar.gz")] | any)'); do
303+
pkg=$(echo "$release" | jq '.artifacts[] | select(endswith("-npm-package.tar.gz"))' --raw-output)
304+
npm publish --access public "./npm/${pkg}"
305+
done
306+
env:
307+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
308+
281309
announce:
282310
needs:
283311
- plan
284312
- host
313+
- publish-npm
285314
# use "always() && ..." to allow us to wait for all publish jobs while
286315
# still allowing individual publish jobs to skip themselves (for prereleases).
287316
# "host" however must run to completion, no skipping allowed!
288-
if: ${{ always() && needs.host.result == 'success' }}
317+
if: ${{ always() && needs.host.result == 'success' && (needs.publish-npm.result == 'skipped' || needs.publish-npm.result == 'success') }}
289318
runs-on: "ubuntu-22.04"
290319
env:
291320
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

dist-workspace.toml

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,14 @@ ci = "github"
1010
# The installers to generate for each app
1111
installers = ["shell", "powershell", "npm"]
1212
# Target platforms to build apps for (Rust target-triple syntax)
13-
targets = [
14-
"aarch64-apple-darwin",
15-
"aarch64-unknown-linux-gnu",
16-
"aarch64-pc-windows-msvc",
17-
"x86_64-apple-darwin",
18-
"x86_64-unknown-linux-gnu",
19-
"x86_64-unknown-linux-musl",
20-
"x86_64-pc-windows-msvc",
21-
]
13+
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"]
2214
# A namespace to use when publishing this package to the npm registry
2315
npm-scope = "@tilepad"
24-
# Name of the cli tool
16+
# The npm package should have this name
2517
npm-package = "cli"
2618
# Path that installers should place binaries in
2719
install-path = "CARGO_HOME"
2820
# Whether to install an updater program
2921
install-updater = false
30-
22+
# Publish jobs to run in CI
3123
publish-jobs = ["npm"]

0 commit comments

Comments
 (0)