diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml new file mode 100644 index 0000000..9706913 --- /dev/null +++ b/.github/workflows/publish.yaml @@ -0,0 +1,24 @@ +name: Publish package to GitHub Packages +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 GitHub Packages + - uses: actions/setup-node@v4 + with: + node-version: '20.x' + registry-url: 'https://npm.pkg.github.com' + # Defaults to the user or organization that owns the workflow file + scope: '@octocat' + - run: npm ci + - run: npm build + - run: npm publish + env: + NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000..195cb45 --- /dev/null +++ b/.npmrc @@ -0,0 +1,3 @@ +//npm.pkg.github.com/:_authToken=${NODE_AUTH_TOKEN} +@octocat:registry=https://npm.pkg.github.com +always-auth=true \ No newline at end of file diff --git a/package.json b/package.json index fb1bf30..7042c35 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "brewskey.js-api", + "name": "@brewskey/js-api", "version": "2.0.0", "main": "./dist/index.js", "repository": "https://github.com/Brewskey/brewskey.js-api.git",