diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9170fd7..db531e0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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/add-and-commit@v9.1.4 + 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: | diff --git a/README.md b/README.md index 2c164ff..95ce70e 100644 --- a/README.md +++ b/README.md @@ -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) diff --git a/deno.json b/deno.json index b635827..83ede4d 100644 --- a/deno.json +++ b/deno.json @@ -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": { diff --git a/scripts/project-version.ts b/scripts/project-version.ts new file mode 100644 index 0000000..df03cf6 --- /dev/null +++ b/scripts/project-version.ts @@ -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]}`);