Skip to content

JSR

JSR #37

Workflow file for this run

name: build
on: [push, pull_request]
jobs:
test:
strategy:
matrix:
os: [macos-12, ubuntu-22.04, windows-2022]
fail-fast: false
runs-on: ${{ matrix.os }}
permissions:
checks: write
pull-requests: write
env:
OS: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: denoland/setup-deno@v1
with:
deno-version: v1.x
- run: >-
deno test
--doc
--coverage=.cov
--junit-path=.test-report.xml
- uses: EnricoMi/publish-unit-test-result-action@v2
if: runner.os == 'Linux' && always()
with:
files: .test-report.xml
- uses: EnricoMi/publish-unit-test-result-action/composite@v2
if: runner.os != 'Linux' && always()
with:
files: .test-report.xml
- run: deno coverage --lcov .cov > .cov.lcov
- uses: codecov/codecov-action@v2
with:
files: .cov.lcov
env_vars: OS
lint:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- uses: denoland/setup-deno@v1
with:
deno-version: v1.x
- run: deno lint
- run: deno fmt --check --ignore=.vscode/
- run: deno publish --dry-run
release:
if: github.event_name == 'push'
needs: [test, lint]
permissions:
contents: read
id-token: write
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- uses: denoland/setup-deno@v1
with:
deno-version: v1.x
- id: determine-version
run: deno run -A scripts/determine-version.ts
- if: github.ref_type == 'tag'
run: |
set -ex
[[ "$(jq -r .version deno.json)" = "$VERSION" ]]
env:
VERSION: ${{ steps.determine-version.outputs.version }}
- if: github.ref_type == 'branch'
run: |
set -ex
jq \
--arg version "$VERSION" \
'.version = $version' \
deno.json > deno.json.tmp
mv deno.json.tmp deno.json
env:
VERSION: ${{ steps.determine-version.outputs.version }}
- if: github.ref_type == 'tag'
run: '[[ "$VERSION" = "$GITHUB_REF_NAME" ]]'
env:
VERSION: ${{ steps.determine-version.outputs.version }}
- run: |
set -e
deno run -A dnt.ts "$VERSION"
pushd npm/
npm pack --dry-run
popd
env:
VERSION: ${{ steps.determine-version.outputs.version }}
- run: deno publish --allow-dirty
- run: |
set -e
cd npm/
npm config set //registry.npmjs.org/:_authToken "$NPM_AUTH_TOKEN"
if [[ "$GITHUB_REF_TYPE" = "tag" ]]; then
npm publish
else
npm publish --tag dev
fi
env:
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}