@@ -439,20 +439,18 @@ jobs:
439
439
name : lib-ocaml
440
440
path : lib/ocaml
441
441
442
- package :
443
- needs :
444
- - build-compiler
445
- - build-rewatch
446
-
442
+ pkg-pr-new :
443
+ needs : [build-rewatch, build-compiler]
444
+ if : github.event_name == 'pull_request'
447
445
runs-on : ubuntu-24.04-arm
448
-
449
446
steps :
450
447
- name : Checkout
451
448
uses : actions/checkout@v4
452
449
453
450
- name : Use Node.js
454
451
uses : actions/setup-node@v4
455
452
with :
453
+ cache : yarn
456
454
node-version-file : .nvmrc
457
455
458
456
- name : Download artifacts
@@ -464,34 +462,13 @@ jobs:
464
462
run : .github/workflows/moveArtifacts.sh
465
463
shell : bash
466
464
467
- - name : Check artifact list
468
- run : node ./scripts/npmPack.js
469
-
470
- - name : yarn pack @rescript/* subpackages
471
- run : yarn workspaces foreach -W --no-private --exclude rescript pack
472
-
473
- - name : Prepare package upload
474
- # For pull requests, pass the correct commit SHA explicitly as GITHUB_SHA points to the wrong commit.
475
- run : node .github/workflows/prepare_package_upload.js ${{ github.event.pull_request.head.sha }}
476
-
477
- - name : " Upload artifact: npm packages"
478
- uses : actions/upload-artifact@v4
479
- with :
480
- name : npm-packages
481
- path : |
482
- rescript-${{ env.rescript_version }}.tgz
483
- rescript-std-${{ env.rescript_version }}.tgz
484
- rescript-linux-x64-${{ env.rescript_version }}.tgz
485
- rescript-linux-arm64-${{ env.rescript_version }}.tgz
486
- rescript-darwin-x64-${{ env.rescript_version }}.tgz
487
- rescript-darwin-arm64-${{ env.rescript_version }}.tgz
488
- rescript-win32-x64-${{ env.rescript_version }}.tgz
489
-
490
- outputs :
491
- rescript_version : ${{ env.rescript_version }}
465
+ - name : Publish packages to pkg.pr.new
466
+ run : |
467
+ yarn dlx pkg-pr-new publish "." "./packages/@rescript/*"
492
468
493
469
installationTest :
494
- needs : package
470
+ needs : [pkg-pr-new]
471
+ if : github.event_name == 'pull_request'
495
472
strategy :
496
473
fail-fast : false
497
474
matrix :
@@ -506,9 +483,7 @@ jobs:
506
483
node-target : linux-arm64
507
484
- os : windows-latest
508
485
node-target : win32-x64
509
-
510
486
runs-on : ${{ matrix.os }}
511
-
512
487
steps :
513
488
- name : Checkout
514
489
uses : actions/checkout@v4
@@ -531,17 +506,10 @@ jobs:
531
506
echo "path=$dir" >> "$GITHUB_OUTPUT"
532
507
cp -r tests/package_tests/installation_test/* "$dir"
533
508
534
- - name : Download artifacts
535
- uses : actions/download-artifact@v4
536
- with :
537
- name : npm-packages
538
- path : ${{ steps.tmp-dir.outputs.path }}
539
-
540
509
- name : Install ReScript package
541
510
run : |
542
- npm i --ignore-scripts --no-audit \
543
- rescript-${{ needs.package.outputs.rescript_version }}.tgz \
544
- rescript-${{ matrix.node-target }}-${{ needs.package.outputs.rescript_version }}.tgz
511
+ COMMIT_SHA="$(git rev-parse --short HEAD)"
512
+ npm i --no-audit "https://pkg.pr.new/rescript-lang/rescript@$COMMIT_SHA"
545
513
shell : bash
546
514
working-directory : ${{ steps.tmp-dir.outputs.path }}
547
515
@@ -550,9 +518,9 @@ jobs:
550
518
shell : bash
551
519
working-directory : ${{ steps.tmp-dir.outputs.path }}
552
520
553
- publish-pr :
554
- needs : [package, installationTest ]
555
- if : github.event_name == 'pull_request'
521
+ publish :
522
+ needs : [build-rewatch, build-compiler ]
523
+ if : startsWith( github.ref, 'refs/tags/v')
556
524
runs-on : ubuntu-24.04-arm
557
525
steps :
558
526
- name : Checkout
@@ -563,6 +531,7 @@ jobs:
563
531
with :
564
532
cache : yarn
565
533
node-version-file : .nvmrc
534
+ registry-url : https://registry.npmjs.org # Needed to make auth work for publishing
566
535
567
536
- name : Download artifacts
568
537
uses : actions/download-artifact@v4
@@ -573,41 +542,12 @@ jobs:
573
542
run : .github/workflows/moveArtifacts.sh
574
543
shell : bash
575
544
576
- - name : Publish packages to pkg.pr.new
577
- run : |
578
- yarn dlx pkg-pr-new publish "." "./packages/@rescript/*"
579
-
580
- publish :
581
- needs : [package, installationTest]
582
- if : startsWith(github.ref, 'refs/tags/v')
583
- runs-on : ubuntu-24.04-arm
584
- steps :
585
- - name : Checkout
586
- uses : actions/checkout@v4
587
-
588
- - name : Use Node.js
589
- uses : actions/setup-node@v4
590
- with :
591
- cache : yarn
592
- node-version-file : .nvmrc
593
- registry-url : https://registry.npmjs.org # Needed to make auth work for publishing
594
-
595
- - name : Download artifacts
596
- uses : actions/download-artifact@v4
597
- with :
598
- name : npm-packages
599
-
600
545
- name : Publish packages on npm with tag "ci"
601
546
env :
602
547
NODE_AUTH_TOKEN : ${{ secrets.NPM_ACCESS_TOKEN }}
603
548
run : |
604
- npm publish --tag ci rescript-${{ needs.package.outputs.rescript_version }}.tgz
605
- npm publish --tag ci rescript-std-${{ needs.package.outputs.rescript_version }}.tgz
606
- npm publish --tag ci rescript-linux-x64-${{ needs.package.outputs.rescript_version }}.tgz
607
- npm publish --tag ci rescript-linux-arm64-${{ needs.package.outputs.rescript_version }}.tgz
608
- npm publish --tag ci rescript-darwin-x64-${{ needs.package.outputs.rescript_version }}.tgz
609
- npm publish --tag ci rescript-darwin-arm64-{{ needs.package.outputs.rescript_version }}.tgz
610
- npm publish --tag ci rescript-win32-x64-${{ needs.package.outputs.rescript_version }}.tgz
549
+ yarn workspaces foreach -W --no-private \
550
+ npm publish --tag ci
611
551
612
552
- name : Update Website Playground
613
553
env :
0 commit comments