Skip to content

Commit

Permalink
ci: add jsr source
Browse files Browse the repository at this point in the history
  • Loading branch information
shevernitskiy committed Apr 11, 2024
1 parent 2d76403 commit a9e9ccf
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 4 deletions.
26 changes: 22 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,40 @@ on:
workflow_dispatch:
inputs:
version:
description: 'Release version'
description: "Release version"
required: true
type: string

jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write # The OIDC ID token is used for authentication with JSR.
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- uses: denoland/setup-deno@main
- name: Setup Deno
uses: denoland/setup-deno@main
with:
deno-version: v1.x

- run: deno task npm ${{ inputs.version }}
- name: Bump project verison
run: deno task version ${{ inputs.version }}

- name: Publish to JSR
run: deno publish

- name: Commit changes
uses: EndBug/[email protected]
with:
author_name: github-actions[bot]
author_email: 41898282+github-actions[bot]@users.noreply.github.com
message: "bump version"

- name: Build npm package
run: deno task npm ${{ inputs.version }}

- name: Publish to npm
run: |
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

[![npm](https://img.shields.io/npm/v/@shevernitskiy/amo?logo=npm&style=flat&labelColor=000)](https://www.npmjs.com/package/@shevernitskiy/amo)
[![deno module](https://shield.deno.dev/x/amo)](https://deno.land/x/amo/mod.ts)
[![jsr](https://img.shields.io/jsr/v/@shevernitskiy/amo?logo=jsr&style=flat&labelColor=000)](https://jsr.io/@shevernitskiy/amo)
![dependencies](https://img.shields.io/badge/dependencies-0-green?style=flat&labelColor=000)
[![license](https://img.shields.io/github/license/shevernitskiy/amo?style=flat&labelColor=000)](https://github.com/shevernitskiy/amo/blob/main/LICENSE)

Expand Down
4 changes: 4 additions & 0 deletions deno.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
{
"name": "@shevernitskiy/amo",
"version": "0.2.4",
"exports": "./mod.ts",
"lock": false,
"tasks": {
"start": "deno run -A run.ts",
"dev": "deno run -A --watch run.ts",
"npm": "deno run -A ./scripts/build-npm.ts",
"version": "deno run -A ./scripts/project-version.ts",
"test": "deno test -A --unstable ./tests"
},
"fmt": {
Expand Down
9 changes: 9 additions & 0 deletions scripts/project-version.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
if (Deno.args[0] === undefined) {
throw Error("missing version arg!");
}

const data = JSON.parse(Deno.readTextFileSync("./deno.json"));
data.version = Deno.args[0];
Deno.writeTextFileSync("./deno.json", JSON.stringify(data, null, 2));

console.log(`version set to ${Deno.args[0]}`);

0 comments on commit a9e9ccf

Please sign in to comment.