Skip to content

chore: apply deno@2 fmt #58

chore: apply deno@2 fmt

chore: apply deno@2 fmt #58

Workflow file for this run

name: CI
on:
push:
branches:
- '**'
tags:
- 'v**'
env:
DENO_VERSION: 2.0
jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: denoland/setup-deno@v1
with:
deno-version: ${{ env.DENO_VERSION }}
- name: Lint
run: deno lint
- name: Format
run: deno fmt --check
- name: Type Check
run: deno check *.ts
- name: Test
run: deno test --no-check --coverage
- name: Report
run: deno coverage
gzip:
name: Module Size
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
with:
bun-version: 1.1.12
- name: gzip (bytes)
run: |
bytes=$(bun build --minify mod.ts | bunx terser --mangle --compress --module --ecma=2020 | gzip -9 | wc -c)
echo "::notice::${bytes} b (gzip)"
dryrun:
needs: [test]
name: 'Publish (dry run)'
if: ${{ !startsWith(github.ref, 'refs/tags/v') }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: denoland/setup-deno@v1
with:
deno-version: ${{ env.DENO_VERSION }}
- run: deno task build 1.2.3
- run: deno publish --no-check -c jsr.json --dry-run
# https://jsr.io/docs/publishing-packages#publishing-from-github-actions
# https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages#publishing-packages-to-the-npm-registry
publish:
needs: [test]
name: Publish
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
permissions:
contents: read
id-token: write # -> authentication
steps:
- uses: actions/checkout@v4
- uses: denoland/setup-deno@v1
with:
deno-version: ${{ env.DENO_VERSION }}
- uses: actions/setup-node@v4
with:
node-version: 20
registry-url: 'https://registry.npmjs.org'
- name: Build
run: |
VERSION=${GITHUB_REF#refs/tags/v}
deno task build $VERSION
- name: 'Publish → jsr'
if: ${{ !contains(github.ref, '-next.') }}
run: deno publish --no-check -c jsr.json
- name: 'Publish → npm'
if: ${{ !contains(github.ref, '-next.') }}
run: npm publish --provenance --access public
working-directory: ./npm
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: 'Publish → npm (pre-release)'
if: ${{ contains(github.ref, '-next.') }}
run: npm publish --tag next --provenance --access public
working-directory: ./npm
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}