Fix npmjs package visibility #573
Workflow file for this run
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: Sanity checks and docs publishing | |
| on: | |
| push: | |
| branches: | |
| - master | |
| pull_request: | |
| branches: | |
| - master | |
| jobs: | |
| fmt-lint: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 2 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0 | |
| - name: Use Node.js 24 | |
| uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0 | |
| with: | |
| node-version: 24 | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Format check | |
| run: npm run fmt:check | |
| - name: Lint | |
| run: npm run lint | |
| tests: | |
| needs: [fmt-lint] | |
| runs-on: ${{ matrix.os }} | |
| timeout-minutes: 10 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, macos-latest] | |
| node: [24, 22, 20] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0 | |
| - name: Use Node.js ${{ matrix.node }} | |
| uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0 | |
| with: | |
| node-version: ${{ matrix.node }} | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Run tests | |
| run: npm test | |
| examples: | |
| needs: [fmt-lint] | |
| runs-on: ${{ matrix.os }} | |
| timeout-minutes: 10 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| node: [24, 22, 20] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0 | |
| - name: Use Node.js ${{ matrix.node }} | |
| uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0 | |
| with: | |
| node-version: ${{ matrix.node }} | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build | |
| run: npm run build | |
| - name: Global install | |
| run: npm install -g . | |
| - name: Run examples | |
| shell: bash | |
| run: | | |
| cd example | |
| rv . counter test | |
| rv . counter invariant | |
| rv . cargo test | |
| rv . cargo invariant | |
| rv . reverse test | |
| rv . slice test | |
| rv . self-listing-helper-v3a test | |
| rv . self-listing-helper-v3a invariant | |
| rv . rendezvous-token invariant --dial=./sip010.cjs | |
| rv . counter test --config=rv.config.json | |
| generate-docs: | |
| needs: [tests, examples] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0 | |
| - name: Setup mdBook | |
| uses: peaceiris/actions-mdbook@ee69d230fe19748b7abf22df32acaa93833fad08 # v2.0.0 | |
| with: | |
| mdbook-version: "0.5.0" | |
| - name: Build docs | |
| run: | | |
| mdbook build docs | |
| - name: Deploy to GitHub Pages | |
| # Only deploy docs if the push is to the master branch. | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/master' | |
| run: | | |
| # Configure Git to commit to gh-pages branch. | |
| git config --global user.name 'GitHub Actions' | |
| git config --global user.email 'actions@github.com' | |
| # The gh-pages branch has no meaningful history since it's completely | |
| # regenerated from scratch on each commit to master. History would be | |
| # noise, not signal. The source of truth is the master branch and the | |
| # build system, making the gh-pages content purely ephemeral output. | |
| # Force pushing an orphan branch gives us exactly what we need: clean | |
| # snapshot of the documentation at each point in time without all the | |
| # baggage of incorrect or outdated history. | |
| # Create orphan branch (no history). | |
| git checkout --orphan gh-pages | |
| # Remove all files from the working tree. | |
| git rm -rf . | |
| # Copy the built site to the root. | |
| cp -r docs/dist/* . | |
| # Add all files. | |
| git add . | |
| # Commit with empty message (since no history on gh-pages anyways). | |
| git commit --allow-empty-message -m '' | |
| # Force push to gh-pages branch (again since no history). | |
| git push origin gh-pages --force |