Skip to content

Commit

Permalink
Add publish-package Github Action
Browse files Browse the repository at this point in the history
  • Loading branch information
danielgelling committed Jan 4, 2024
1 parent 50a376e commit 9b7d5c6
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 17 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/publish-package.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Publish package to GitHub Packages
on:
release:
types: [published]
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
steps:
- uses: actions/checkout@v4
- run: git config user.name release-bot
- run: git config user.email [email protected]

# Setup .npmrc file to publish to GitHub Packages
- uses: actions/setup-node@v3
with:
node-version: '20.x'
registry-url: 'https://npm.pkg.github.com'
# Defaults to the user or organization that owns the workflow file
scope: '@danielgelling'
- run: npm ci

- run: |
npm version --no-git-tag-version ${TAG_NAME:1}
git add package.json package-lock.json
git commit -m "Bump package version to ${TAG_NAME:1}"
git push origin HEAD:master
env:
TAG_NAME: ${{ github.event.release.tag_name }}
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
37 changes: 23 additions & 14 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "p1-monitor",
"name": "@danielgelling/p1-monitor",
"version": "0.0.1",
"description": "Module to monitor a Smart Meter using its P1 port",
"main": "lib/index.js",
Expand All @@ -16,13 +16,13 @@
"license": "MIT",
"dependencies": {
"luxon": "^3.3.0",
"node": "^20.4.0",
"node": "^20.10.0",
"serialport": "^11.0.0"
},
"devDependencies": {
"@types/jest": "^29.5.11",
"@types/luxon": "^3.3.0",
"@types/node": "^20.4.1",
"@types/node": "^20.10.6",
"@typescript-eslint/eslint-plugin": "^6.17.0",
"@typescript-eslint/parser": "^6.17.0",
"eslint": "^8.44.0",
Expand Down

0 comments on commit 9b7d5c6

Please sign in to comment.