rename Prelude to Base and split Base.Types #575
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: "22" | |
| registry-url: https://registry.npmjs.org # Needed to make auth work for publishing | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Check formatting | |
| run: npm run format:check | |
| - name: Rebuild ReScript code | |
| run: npm run build | |
| - name: Run tests | |
| run: npm test | |
| - name: Build documentation | |
| run: npm run build:docs | |
| - name: Upload documentation | |
| uses: actions/upload-pages-artifact@v4 | |
| if: github.ref == 'refs/heads/main' && github.event_name == 'push' | |
| with: | |
| path: ./dist | |
| - name: get-npm-version | |
| id: package-version | |
| uses: martinbeentjes/npm-get-version-action@v1.3.1 | |
| - name: Get short commit hash | |
| id: vars | |
| run: echo "COMMIT_HASH=$(git rev-parse --short HEAD)" >> $GITHUB_ENV | |
| - name: Update workspace versions to -<commit-hash> | |
| env: | |
| PACKAGE_VERSION: ${{ steps.package-version.outputs.current-version }}-experimental-${{ env.COMMIT_HASH }} | |
| run: | | |
| node <<'NODE' | |
| const fs = require("node:fs"); | |
| const path = require("node:path"); | |
| const packagesDir = path.join(process.cwd(), "packages"); | |
| const version = process.env.PACKAGE_VERSION; | |
| const packages = fs | |
| .readdirSync(packagesDir) | |
| .filter((dir) => fs.existsSync(path.join(packagesDir, dir, "package.json"))) | |
| .map((dir) => { | |
| const packageJsonPath = path.join(packagesDir, dir, "package.json"); | |
| const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf8")); | |
| return { packageJsonPath, packageJson }; | |
| }); | |
| const workspaceNames = new Set(packages.map(({ packageJson }) => packageJson.name)); | |
| for (const { packageJsonPath, packageJson } of packages) { | |
| packageJson.version = version; | |
| for (const field of ["dependencies", "peerDependencies", "devDependencies"]) { | |
| if (!packageJson[field]) continue; | |
| for (const dependencyName of Object.keys(packageJson[field])) { | |
| if (workspaceNames.has(dependencyName)) { | |
| packageJson[field][dependencyName] = version; | |
| } | |
| } | |
| } | |
| fs.writeFileSync(packageJsonPath, `${JSON.stringify(packageJson, null, 2)}\n`); | |
| } | |
| NODE | |
| - name: Package npm workspaces | |
| run: npm pack --workspaces | |
| - name: Upload npm package artifact | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: npm-packages | |
| path: "*.tgz" | |
| - name: Publish npm packages | |
| if: github.ref == 'refs/heads/main' && github.event_name == 'push' | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }} | |
| run: | | |
| for package in packages/*; do | |
| if [ -f "$package/package.json" ]; then | |
| npm publish --workspace "$package" --access public --tag experimental | |
| fi | |
| done | |
| deploy-docs: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| if: github.ref == 'refs/heads/main' && github.event_name == 'push' | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v5 |