Skip to content

Commit

Permalink
46 Add build step to CI (#47)
Browse files Browse the repository at this point in the history
## Description

<!-- Describe your changes in detail -->
<!-- Does this fix a bug, implement a new feature, etc? -->
- Adds GitHub action to publish package to NPM

[Docs
here](https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages)

### Related Issue(s)

<!-- Reference the issue this PR relates to -->
<!-- Use keywords if possible (ex. Closes #10 ) -->
<!--
https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/using-keywords-in-issues-and-pull-requests
-->

## Screenshots

<!-- (if applicable) -->
  • Loading branch information
riccjohn authored Jun 11, 2024
2 parents e68d394 + f98c791 commit c0bbfea
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 4 deletions.
15 changes: 14 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,21 @@ jobs:
ref: ${{env.GITHUB_REF}}
- uses: actions/setup-node@v4
with:
node-version: '18'
node-version: '20.x'
cache: 'yarn'
cache-dependency-path: yarn.lock
- run: yarn install --frozen-lockfile
- run: yarn test:ci
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{env.GITHUB_REF}}
- uses: actions/setup-node@v4
with:
node-version: '20.x'
cache: 'yarn'
cache-dependency-path: yarn.lock
- run: yarn install --frozen-lockfile
- run: yarn build
19 changes: 19 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Publish Package to npmjs
on:
release:
types: [published]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Setup .npmrc file to publish to npm
- uses: actions/setup-node@v4
with:
node-version: '20.x'
registry-url: 'https://registry.npmjs.org'
- run: yarn install --frozen-lockfile
- run: tsc
- run: yarn npm publish --provenance --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
8 changes: 5 additions & 3 deletions src/knave/__mocks__/Gear.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import type { GearItem, ArmorItem, WeaponItem } from '../Gear'

class Gear {
public itemSlots: number
public items: IGear[]
public armor: IArmor[]
public weapon: IWeapon
public items: GearItem[]
public armor: ArmorItem[]
public weapon: WeaponItem

constructor(itemSlots: number) {
this.itemSlots = itemSlots
Expand Down

0 comments on commit c0bbfea

Please sign in to comment.