Skip to content

Publish to JSR

Publish to JSR #12

Workflow file for this run

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" \
--arg commit "${GITHUB_SHA::8}" \
'.version = .version + "-dev." + $build + "+" + $commit' \
deno.json > deno.json.tmp
mv deno.json.tmp deno.json
# Don't know why, but the .gitignore list is not overriden by include list
# in deno.json:
rm vocab/.gitignore
- if: github.ref_type == 'tag'
run: '[[ "$(jq .version deno.json)" = "$GITHUB_REF_NAME" ]]'
- run: deno task publish