diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4d6db56..15f865e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,15 +5,13 @@ on: branches: - main +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: test: runs-on: ubuntu-latest - # runs-on: ${{ matrix.os }} - - # strategy: - # matrix: - # os: [ubuntu-latest, macos-latest] - # fail-fast: false steps: - id: checkout diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 44fb6cd..20b2fc0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -4,34 +4,30 @@ on: push: branches: - "main" + - "next" -permissions: - contents: read - pull-requests: read +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true jobs: release: + if: "!contains(github.event.head_commit.message, '[skip ci]')" + + permissions: + contents: write + runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 with: fetch-depth: 0 + persist-credentials: false - - name: Bump version and push tag - id: tag_version - uses: mathieudutour/github-tag-action@v6.2 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} + - uses: oven-sh/setup-bun@v1 - # - name: Changelog - # uses: scottbrenner/generate-changelog-action@master - # id: changelog - # with: - # package-dir: "./package.json" - - - name: Create a GitHub release - uses: ncipollo/release-action@v1 - with: - tag: ${{ steps.tag_version.outputs.new_tag }} - name: Release ${{ steps.tag_version.outputs.new_tag }} - body: ${{ steps.tag_version.outputs.changelog }} + - name: Run semantic release + run: | + bun run release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.releaserc b/.releaserc new file mode 100644 index 0000000..3a2f798 --- /dev/null +++ b/.releaserc @@ -0,0 +1,51 @@ +{ + "branches": [ + "main", + { + "name": "next", + "prerelease": true + } + ], + "plugins": [ + [ + "@semantic-release/commit-analyzer", + { + "preset": "conventionalcommits" + } + ], + [ + "@semantic-release/release-notes-generator", + { + "preset": "conventionalcommits" + } + ], + "@semantic-release/npm", + [ + "@semantic-release/exec", + { + "prepareCmd": "yarn run build" + } + ], + "@semantic-release/changelog", + [ + "@semantic-release/git", + { + "assets": [ + "package.json", + "changelog" + ], + "message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}" + } + ], + [ + "@semantic-release/github", + { + "assets": [ + { + "path": "dist" + } + ] + } + ] + ] +} diff --git a/bun.lockb b/bun.lockb index b601e32..5dbe0ca 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/package.json b/package.json index 2e1e46c..23efc6d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "eldenring-json", - "version": "0.0.1", + "version": "0.0.0-semantically-released", "main": "dist/index.js", "types": "dist/index.d.ts", "description": "collection of available data for Elden Ring by Fromsoft", @@ -9,6 +9,7 @@ "prebuild": "rm -rf dist", "build:types": "tsc --emitDeclarationOnly --noEmit false --declaration true", "publish": "bunx @morlay/bunpublish", + "release": "bunx semantic-release", "prepublishOnly": "bun run build" }, "files": [ @@ -30,8 +31,12 @@ "bugs": "https://github.com/joeyfigaro/eldenring-json/issues", "author": "Joey Figaro ", "devDependencies": { - "bun-plugin-dts": "^0.2.1", + "@semantic-release/changelog": "^6.0.3", + "@semantic-release/exec": "^6.0.3", + "@semantic-release/git": "^10.0.1", "@types/bun": "^1.0.0", + "bun-plugin-dts": "^0.2.1", + "semantic-release": "^23.0.6", "typescript": "^5.2.2" } } diff --git a/test/index.test.ts b/test/index.test.ts index d53de8e..6c80ad1 100644 --- a/test/index.test.ts +++ b/test/index.test.ts @@ -1,8 +1,13 @@ -import { describe, it, expect } from 'bun:test'; -import { ammos } from '../src'; +import { describe, it, expect } from "bun:test"; +import * as json from "../src"; -describe('data exports', () => { - it('should include ammo', () => { - expect(ammos).toBeDefined(); +describe("available JSON data", () => { + const availableKeys = Object.keys(json); + + availableKeys.forEach((key) => { + it(`should include ${key}`, () => { + // @ts-expect-error + expect(json[key]).toBeDefined(); + }); }); });