Skip to content

Commit dfceb35

Browse files
authored
feat: initial implementation (#1)
1 parent 0d5424b commit dfceb35

14 files changed

+6147
-0
lines changed

.github/workflows/ci.yml

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: ci
2+
3+
on:
4+
pull_request:
5+
branches: [main]
6+
push:
7+
branches: [main]
8+
tags:
9+
- '*'
10+
workflow_dispatch:
11+
12+
jobs:
13+
rust:
14+
name: deno_npm-ubuntu-latest-release
15+
runs-on: ubuntu-latest
16+
timeout-minutes: 30
17+
18+
env:
19+
CARGO_INCREMENTAL: 0
20+
GH_ACTIONS: 1
21+
RUST_BACKTRACE: full
22+
RUSTFLAGS: -D warnings
23+
24+
steps:
25+
- name: Clone repository
26+
uses: actions/checkout@v3
27+
28+
- uses: denoland/setup-deno@v1
29+
- uses: dsherret/rust-toolchain-file@v1
30+
31+
- name: Cache
32+
uses: Swatinem/rust-cache@v1
33+
34+
- name: Format
35+
run: cargo fmt --all -- --check
36+
37+
- name: Lint
38+
run: cargo clippy --all-targets --all-features --release
39+
40+
- name: Build
41+
run: cargo build --all-targets --all-features --release
42+
- name: Test
43+
run: cargo test --all-targets --all-features --release
44+
45+
- name: Publish
46+
if: |
47+
github.repository == 'denoland/deno_npm' &&
48+
startsWith(github.ref, 'refs/tags/')
49+
env:
50+
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
51+
run: |
52+
cargo publish

.github/workflows/release.yml

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
releaseKind:
7+
description: 'Kind of release'
8+
default: 'minor'
9+
type: choice
10+
options:
11+
- patch
12+
- minor
13+
required: true
14+
15+
jobs:
16+
rust:
17+
name: release
18+
runs-on: ubuntu-latest
19+
timeout-minutes: 30
20+
21+
steps:
22+
- name: Clone repository
23+
uses: actions/checkout@v3
24+
with:
25+
token: ${{ secrets.DENOBOT_PAT }}
26+
27+
- uses: denoland/setup-deno@v1
28+
- uses: dsherret/rust-toolchain-file@v1
29+
30+
- name: Tag and release
31+
env:
32+
GITHUB_TOKEN: ${{ secrets.DENOBOT_PAT }}
33+
GH_WORKFLOW_ACTOR: ${{ github.actor }}
34+
run: |
35+
git config user.email "denobot@users.noreply.github.com"
36+
git config user.name "denobot"
37+
deno run -A https://raw.githubusercontent.com/denoland/automation/0.15.0/tasks/publish_release.ts --${{github.event.inputs.releaseKind}}

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.vscode/
2+
/target

.rustfmt.toml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
max_width = 80
2+
tab_spaces = 2
3+
edition = "2021"

0 commit comments

Comments
 (0)