diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a4beafce16..7c1c4828a8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -439,13 +439,11 @@ jobs: name: lib-ocaml path: lib/ocaml - package: - needs: - - build-compiler + pkg-pr-new: + needs: - build-rewatch - + - build-compiler runs-on: ubuntu-24.04-arm - steps: - name: Checkout uses: actions/checkout@v4 @@ -453,6 +451,7 @@ jobs: - name: Use Node.js uses: actions/setup-node@v4 with: + cache: yarn node-version-file: .nvmrc - name: Download artifacts @@ -464,34 +463,13 @@ jobs: run: .github/workflows/moveArtifacts.sh shell: bash - - name: Check artifact list - run: node ./scripts/npmPack.js - - - name: yarn pack @rescript/* subpackages - run: yarn workspaces foreach -W --no-private --exclude rescript pack - - - name: Prepare package upload - # For pull requests, pass the correct commit SHA explicitly as GITHUB_SHA points to the wrong commit. - run: node .github/workflows/prepare_package_upload.js ${{ github.event.pull_request.head.sha }} - - - name: "Upload artifact: npm packages" - uses: actions/upload-artifact@v4 - with: - name: npm-packages - path: | - rescript-${{ env.rescript_version }}.tgz - rescript-std-${{ env.rescript_version }}.tgz - rescript-linux-x64-${{ env.rescript_version }}.tgz - rescript-linux-arm64-${{ env.rescript_version }}.tgz - rescript-darwin-x64-${{ env.rescript_version }}.tgz - rescript-darwin-arm64-${{ env.rescript_version }}.tgz - rescript-win32-x64-${{ env.rescript_version }}.tgz - - outputs: - rescript_version: ${{ env.rescript_version }} + - name: Publish packages to pkg.pr.new + run: | + yarn dlx pkg-pr-new publish "." "./packages/@rescript/*" installationTest: - needs: package + needs: + - pkg-pr-new strategy: fail-fast: false matrix: @@ -506,11 +484,10 @@ jobs: node-target: linux-arm64 - os: windows-latest node-target: win32-x64 - runs-on: ${{ matrix.os }} - steps: - name: Checkout + id: checkout uses: actions/checkout@v4 - name: Use Node.js @@ -531,17 +508,11 @@ jobs: echo "path=$dir" >> "$GITHUB_OUTPUT" cp -r tests/package_tests/installation_test/* "$dir" - - name: Download artifacts - uses: actions/download-artifact@v4 - with: - name: npm-packages - path: ${{ steps.tmp-dir.outputs.path }} - - name: Install ReScript package run: | - npm i --ignore-scripts --no-audit \ - rescript-${{ needs.package.outputs.rescript_version }}.tgz \ - rescript-${{ matrix.node-target }}-${{ needs.package.outputs.rescript_version }}.tgz + COMMIT_SHA="${{ github.event.pull_request.head.sha || github.sha }}" + npm i --no-audit \ + "https://pkg.pr.new/rescript-lang/rescript@${COMMIT_SHA::7}" shell: bash working-directory: ${{ steps.tmp-dir.outputs.path }} @@ -551,12 +522,12 @@ jobs: working-directory: ${{ steps.tmp-dir.outputs.path }} publish: - needs: [package, installationTest] - + needs: + - build-rewatch + - build-compiler + - installationTest if: startsWith(github.ref, 'refs/tags/v') - runs-on: ubuntu-24.04-arm - steps: - name: Checkout uses: actions/checkout@v4 @@ -571,19 +542,18 @@ jobs: - name: Download artifacts uses: actions/download-artifact@v4 with: - name: npm-packages + pattern: "@(binaries-*|rewatch-*|lib-ocaml)" + + - name: Move artifacts into packages + run: .github/workflows/moveArtifacts.sh + shell: bash - name: Publish packages on npm with tag "ci" env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }} + YARN_NPM_AUTH_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }} run: | - npm publish --tag ci rescript-${{ needs.package.outputs.rescript_version }}.tgz - npm publish --tag ci rescript-std-${{ needs.package.outputs.rescript_version }}.tgz - npm publish --tag ci rescript-linux-x64-${{ needs.package.outputs.rescript_version }}.tgz - npm publish --tag ci rescript-linux-arm64-${{ needs.package.outputs.rescript_version }}.tgz - npm publish --tag ci rescript-darwin-x64-${{ needs.package.outputs.rescript_version }}.tgz - npm publish --tag ci rescript-darwin-arm64-{{ needs.package.outputs.rescript_version }}.tgz - npm publish --tag ci rescript-win32-x64-${{ needs.package.outputs.rescript_version }}.tgz + yarn workspaces foreach -W --no-private \ + npm publish --tag ci - name: Update Website Playground env: diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 960f78d4ef..6613c99474 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -395,33 +395,24 @@ To build a new version and release it on NPM, follow these steps: ## Debugging issues from CI builds -To reproduce issues, it can be helpful to the team to install a specific version of the compiler. To do so: +To reproduce issues, it can be helpful to the team to install a specific version of the compiler. -1. Go to [Actions CI for master](https://github.com/rescript-lang/rescript-compiler/actions/workflows/ci.yml?query=branch%3Amaster) - - If you need a specific branch, select a different one to filter to in the GitHub UI. -1. Select a specific run (likely the latest) -1. Under "Artifacts", download the `npm-packages` artifact and extract it to a folder. -1. In your repository run: +ReScript uses [pkg.pr.new](https://github.com/stackblitz-labs/pkg.pr.new) for continuous releases. Once tests are passed successfully, the bot comment is available. -```console -npm i /npm-packages/rescript-*.tgz -``` +Follow the instructions from the comment, which are like: -If you use Yarn or pnpm, you should override platform package resolutions by [`resolutions`](https://yarnpkg.com/configuration/manifest#resolutions) in Yarn or [`overrides`](https://pnpm.io/settings#overrides) in Pnpm. +```bash +# Use NPM +npm i "https://pkg.pr.new/rescript-lang/rescript@${PR_NUMBER}" -``` -{ - "resolutions": { - "@rescript/linux-x64": "/npm-packages/rescript-linux-x64.tgz", - "@rescript/linux-arm64": "/npm-packages/rescript-linux-arm64.tgz", - "@rescript/darwin-x64": "/npm-packages/rescript-darwin-x64.tgz", - "@rescript/darwin-arm64": "/npm-packages/rescript-darwin-arm64.tgz", - "@rescript/win32-x64": "/npm-packages/rescript-win32-x64.tgz" - } -} +# Use Yarn +yarn add "rescript@https://pkg.pr.new/rescript-lang/rescript@${PR_NUMBER}" + +# Use pnpm +pnpm add "https://pkg.pr.new/rescript-lang/rescript@${PR_NUMBER}" ``` -1. Then attempt to rebuild your project as you would normally. +Then attempt to rebuild your project as you would normally. ## Contribution Licensing