Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
semantic-release-npm-github
Advanced tools
Shareable configuration for automated package publication to NPM and GitHub using semantic-release, tailored for OSS projects
Shareable configuration automated package publication to NPM and GitHub using semantic-release, tailored for OSS projects.
chore
, docs
, refactor
and style
changes in PATCH releasespackage.json
semantic-release
npm install --save-dev semantic-release
npm install --save-dev semantic-release-npm-github
package.json
file:{
"extends": "semantic-release-npm-github",
"branch": "main"
}
Once everything is installed, you can test your config with a dry run:
npx semantic-release --dry-run
What you'll probably want to do next is configure a GitHub workflow to run your tests and publish new versions automatically.
Here's a example workflow configuration that runs your tests and publishes a new version for new commits on main
branch:
name: release
on:
push:
branches:
- main
jobs:
test:
name: Run tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: '>=14'
- run: |
npm ci
npm test
env:
CI: true
release:
name: Publish release
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: '>=14'
- run: |
npm ci
npm build --if-present
env:
CI: true
- run: npx semantic-release
if: success()
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
In addition, for this workflow to work correctly you have to generate an NPM authentication token and set it to the NPM_TOKEN
secret in your GitHub repository.
If you're releasing a GitHub protected branch you need to change the git commiter to an owner/admin and allow repo admins to bypass the branch protection (make sure "include administrators" is disabled in the branch protection rules.)
If your repo is under an organisation, you can create a bot account and give it admin rights on the repo. If your repo is under a personal account, you have no choice to make the repo owner the commiter for the release.
Either way, you have to create a GitHub personal access token for the commiter account and give it the "repo" access rights. Then set it to the GH_TOKEN
secret in your GitHub repository.
Finally, make these two changes to your workflow:
...
- uses: actions/checkout@v2
# Add this to commit with a different account than the one
# used for checkout
with:
persist-credentials: false
...
- run: npx semantic-release
if: success()
env:
# Change the secret used here
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
# Add this to set the new commiter for the release
GIT_COMMITTER_NAME: admin-or-owner
GIT_COMMITTER_EMAIL: associated-email@address.com
Note: GitHub secrets not shared with forks and pull requests, so no one that doesn't have write access to your repo can use of them.
FAQs
Shareable configuration for automated package publication to NPM and GitHub using semantic-release, tailored for OSS projects
The npm package semantic-release-npm-github receives a total of 73 weekly downloads. As such, semantic-release-npm-github popularity was classified as not popular.
We found that semantic-release-npm-github demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.