Publish to JSR #4
This file contains 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: build | |
on: [push, pull_request] | |
jobs: | |
test: | |
strategy: | |
matrix: | |
os: [macos-latest, ubuntu-latest, windows-latest] | |
fail-fast: false | |
runs-on: ${{ matrix.os }} | |
permissions: | |
contents: read | |
issues: read | |
checks: write | |
pull-requests: write | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: denoland/setup-deno@v1 | |
with: | |
deno-version: v1.x | |
- run: deno task test --coverage=.cov --junit-path=.test-report.xml | |
- uses: EnricoMi/publish-unit-test-result-action@v2 | |
if: runner.os == 'Linux' && always() | |
with: | |
check_name: "Test Results (Linux)" | |
files: .test-report.xml | |
- uses: EnricoMi/publish-unit-test-result-action/macos@v2 | |
if: runner.os == 'macOS' && always() | |
with: | |
check_name: "Test Results (macOS)" | |
files: .test-report.xml | |
- uses: EnricoMi/publish-unit-test-result-action/windows@v2 | |
if: runner.os == 'Windows' && always() | |
with: | |
check_name: "Test Results (Windows)" | |
files: .test-report.xml | |
- run: deno coverage --lcov .cov > .cov.lcov | |
lint: | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
contents: read | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: denoland/setup-deno@v1 | |
with: | |
deno-version: v1.x | |
- run: deno task check | |
- run: deno task check | |
working-directory: ${{ github.workspace }}/examples/blog/ | |
- run: deno task publish --dry-run | |
publish: | |
if: github.event_name == 'push' | |
needs: [test, lint] | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
contents: read | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: denoland/setup-deno@v1 | |
with: | |
deno-version: v1.x | |
- if: github.ref_type == 'branch' | |
run: | | |
jq \ | |
--arg build "$GITHUB_RUN_NUMBER" \ | |
'.version = .version + "-dev." + $build + "+" + $commit' \ | |
deno.json > deno.json.tmp | |
mv deno.json.tmp deno.json | |
- if: github.ref_type == 'tag' | |
run: '[[ "$(jq .version deno.json)" = "$GITHUB_REF_NAME" ]]' | |
- run: deno task publish |