Skip to content

Commit

Permalink
ci: npm
Browse files Browse the repository at this point in the history
Create release-package-to-github.yml
Create release-package-to-npm.yml
Delete release-package.yml
Update package.json
  • Loading branch information
VirgilClyne committed Dec 4, 2024
1 parent e9585f0 commit 4d1f369
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Node.js Package
name: Release Node.js Package to GitHub Package Registry

on:
push:
Expand Down Expand Up @@ -33,8 +33,7 @@ jobs:
ignore-semver-check: "false" # If set to "true", will not check if the version number is a valid semver version.
- uses: actions/setup-node@v4
with:
node-version: 16
registry-url: https://npm.pkg.github.com/
registry-url: 'https://npm.pkg.github.com'
- run: npm ci
- run: npm publish
env:
Expand Down
41 changes: 41 additions & 0 deletions .github/workflows/release-package-to-npm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Release Node.js Package to NPM Registry

on:
push:
# Sequence of patterns matched against refs/tags
tags:
- "v*" # Push events to matching v*, i.e. v1.0, v20.15.10

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 16
- run: npm ci
- run: npm test

publish-gpr:
needs: build
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- uses: actions/checkout@v4
- name: Update local package.json version from release tag
uses: BellCubeDev/update-package-version-by-release-tag@v2
with:
version: ${{ github.ref_name }}
keep-v: "false" # If set to "true", will not remove any 'v' prefix from the version number.
ignore-semver-check: "false" # If set to "true", will not check if the version number is a valid semver version.
- uses: actions/setup-node@v4
with:
node-version: 16
registry-url: 'https://registry.npmjs.org'
- run: npm ci
- run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
4 changes: 1 addition & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"javascriptcore"
],
"license": "Apache-2.0",
"bugs": "https://github.com/NSNanoCat/URL/issues",
"main": "URL.mjs",
"type": "module",
"scripts": {
Expand All @@ -28,9 +29,6 @@
"URL.mjs",
"URLSearchParams.mjs"
],
"publishConfig": {
"@nsnanocat:registry": "https://npm.pkg.github.com"
},
"devDependencies": {
"@types/node": "^22.9.0",
"mocha": "^10.8.2",
Expand Down

0 comments on commit 4d1f369

Please sign in to comment.