Skip to content

Commit

Permalink
Add github workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
jackkleeman committed Sep 5, 2024
1 parent 775628c commit a60f75a
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 1 deletion.
23 changes: 23 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Publish package to NPM
on:
release:
types: [published]
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
# Setup .npmrc file to publish to NPM
- uses: actions/setup-node@v4
with:
node-version: "19.x"
registry-url: "https://registry.npmjs.org"
- run: npm ci
- run: npm run proto
- run: npm run build
- run: npm publish --tag latest --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
27 changes: 27 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Build and test

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
build:
# prevent from running on forks
if: github.repository_owner == 'restatedev'
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [19.x]

steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
registry-url: "https://registry.npmjs.org"
- run: npm run clean
- run: npm ci
- run: npm run verify
14 changes: 13 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"dist"
],
"scripts": {
"clean": "rm -rf dist",
"build": "npm run build:cjs && npm run build:esm",
"build:cjs": "tsc --module commonjs --verbatimModuleSyntax false --moduleResolution node10 --outDir ./dist/cjs --declaration --declarationDir ./dist/cjs && echo >./dist/cjs/package.json '{\"type\":\"commonjs\"}'",
"build:esm": "tsc --outDir ./dist/esm --declaration --declarationDir ./dist/esm",
Expand All @@ -43,7 +44,6 @@
},
"devDependencies": {
"@arethetypeswrong/cli": "^0.15.3",
"@release-it-plugins/workspaces": "^4.2.0",
"@types/node": "^20.10.4",
"@typescript-eslint/eslint-plugin": "^7.13.0",
"@typescript-eslint/parser": "^7.13.0",
Expand All @@ -56,5 +56,17 @@
"tsx": "^4.19.0",
"typescript": "^5.4.5",
"vitest": "^1.6.0"
},
"publishConfig": {
"@restatedev:registry": "https://registry.npmjs.org"
},
"release-it": {
"git": {
"pushRepo": "https://github.com/restatedev/xstate.git"
},
"github": {
"release": true
},
"npm": false
}
}

0 comments on commit a60f75a

Please sign in to comment.