Define default options in a single place, autogenerate CLI help #69
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: ci | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| permissions: | |
| contents: read # for checkout | |
| env: | |
| FORCE_COLOR: 2 | |
| NODE: 22 | |
| jobs: | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE }} | |
| cache: npm | |
| - run: npm ci | |
| - run: npm run lint | |
| test: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| node: [20, 22] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ matrix.node }} | |
| cache: npm | |
| - run: node -v | |
| - run: npm ci | |
| - run: npm run test | |
| - run: npm run coverage | |
| - name: Upload results to Codecov | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| docs: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE }} | |
| cache: npm | |
| - run: npm ci | |
| - run: npm run docs-test | |
| release: | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| runs-on: ubuntu-latest | |
| needs: [lint, test] | |
| permissions: | |
| contents: write # to be able to publish a GitHub release | |
| issues: write # to be able to comment on released issues | |
| pull-requests: write # to be able to comment on released pull requests | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE }} | |
| cache: npm | |
| - run: npm ci | |
| - run: npm run build | |
| # Uses commit SHA of main branch because reading bun version from | |
| # `engines` field is not yet included in a release. | |
| - uses: oven-sh/setup-bun@22457c87c1b161cf7dde222c3e82b2b5f8d2bed2 | |
| with: | |
| bun-version-file: package.json | |
| - name: Build binaries using bun | |
| run: | | |
| mkdir -p build/binaries | |
| for TARGET in linux-x64 linux-arm64 windows-x64 darwin-x64 darwin-arm64 linux-x64-musl linux-arm64-musl; do | |
| bun build ./build/src/cli.js \ | |
| --compile \ | |
| --minify \ | |
| --sourcemap \ | |
| --target bun-$TARGET \ | |
| --outfile build/binaries/linkinator-$TARGET | |
| done | |
| - run: npx semantic-release | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |