refactor: undo monorepo #590
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 package version 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 packageJsonPath = "package.json"; | |
| const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf8")); | |
| packageJson.version = process.env.PACKAGE_VERSION; | |
| fs.writeFileSync(packageJsonPath, `${JSON.stringify(packageJson, null, 2)}\n`); | |
| NODE | |
| - name: Package npm package | |
| run: npm pack | |
| - name: Upload npm package artifact | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: npm-packages | |
| path: "*.tgz" | |
| - name: Publish npm package | |
| if: github.ref == 'refs/heads/main' && github.event_name == 'push' | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }} | |
| run: npm publish --access public --tag experimental | |
| 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 |