Tips for triggering a Github workflow solely based on changes in the package.json version

I am looking to trigger the Github workflow only when the package version has been updated. After running npm version patch and pushing to GitHub, I want to publish this new version. Despite my attempts, it still triggers a build with every merge.

name: Publish test module

on:
  push:
    branches:
      - main
    paths:
      - packages/testmodule/package.json
      - '*.json'
      - .github/workflows/test.yml

Answer №1

If you're looking to automate your npm releases on GitHub, consider using the github-action-npm-release.

Below is a simple example of how to set it up:

name: Release
on:
  push:
    branches:
      - master

jobs:
  build:
    name: Release
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v2
        with:
          fetch-depth: 0
      - name: Release
        uses: justincy/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="513638253924337c303225383e3f7c3f213c7c23343d343022341127607f637f61">[email protected]</a>
        id: release
      - name: Print release output
        if: ${{ steps.release.outputs.released == 'true' }}
        run: echo Release ID ${{ steps.release.outputs.release_id }}

This action focuses solely on checking if the version in your package.json has been updated. For handling releases, consider using the version-check instead.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Error in TypeScript React: "Could not locate module: Unable to locate 'styled-components'"

Even though I have installed the @types/styled-components package and compiled my Typescript React app, I am consistently encountering this error: Module not found: Can't resolve 'styled-components' I have double-checked that 'style ...

Having issues including the directory "www" into the GitHub repository

After following the steps below, I created my own rustwasm project: cargo generate --git https://github.com/rustwasm/wasm-pack-template wasm-pack build npm init wasm-app www I've put in time and effort into the www folder, but whenever I attempt to c ...

What is the best way to automatically connect npm packages during installation?

I am currently involved in a large project that is divided into multiple npm packages. These packages have dependencies on each other, and the entire code base is stored in a main directory structure like this: main/ pkg1/ pkg2/ ... For example, if ...

The engine for integrating [email protected] with node-red-contrib-amqp is not compatible

Is the latest version of node-red installed on Ubuntu 20.04? I'm attempting to include the node-red-contrib-amqp plugin according to the instructions on the GitHub page. https://github.com/abreits/node-red-contrib-amqp#installation $ sudo npm instal ...

What could be causing the EBUSY: resource busy or locked, open errno: -4082 error to appear while trying to build storybook 7 in next.js 13?

While attempting to create a storybook, I encountered the following error in my project: [Error: EBUSY: resource busy or locked, open 'C:\Users\ali\Desktop\Works\Design Systems\projects\storybook-test2\node_modu ...

Module for Npm that includes unique code for both proxy support and non-proxy support configurations

Is there a way to develop a javascript library (available as a module on npm) with multiple implementations based on the level of proxy support in the environment where it is executed (transpiled to)? From my understanding, babel may not easily transpile ...

What steps should be taken to upgrade a ReactJS project to utilize Node.js version 18.12.0 and npm version 8.19.2

Having recently updated my Node.js version to 18.12.0, I encountered some errors when trying to run my React.js project with the command npm start. The errors displayed were: Compiled with problems:X ERROR in ./src/assets/images/arrow_vector.svg Module ...

The Typescript compiler has trouble locating the definition file for an npm package

Recently, I released an npm package that was written in typescript. However, I have been facing difficulties in getting the definition recognized by typescript (webback and vscode). The only workaround that has worked for me so far is creating a folder wit ...

Installing third party libraries in Node.js on Google Cloud involves using the npm package manager

As I attempt to deploy my code on Google Cloud, everything runs smoothly during testing. However, when I execute the command: gcloud app deploy An error is displayed. Specifically, I am trying to install Node.js canvas which necessitates certain depend ...

Image Viewer Plugin for Ionic Framework

Looking for an Ionic plugin that allows displaying images with zoom functionality and rotate buttons. If not, any suggestions on how to add a rotate button using Ionic native photo viewer? ...

Personalize your commit message when utilizing npm version patch

Can the commit message be personalized when using npm version patch? I would prefer to modify it to :up-arrow: @VERSIONNUMBER ...

Experiencing a problem while attempting to start an Android React Native project

Whenever I try to execute the react-native run-android command, the following message appears: info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag. Jetifier found 998 file(s) to forward-jetify. Using 12 wo ...

Error: The plugin "babel-plugin-transform-builtin-extend" is not recognized

When attempting to complete exercises on exercism, I keep encountering the error message: ReferenceError: Unknown plugin "babel-plugin-transform-builtin-extend" each time I try to run tests with npm install. Below is a snippet of my package.json file and t ...

Troubleshooting Error 405 in AJAX, Javascript, Node.js (including Body-Parser and CORS), and XMLHttpRequest

I have been working on creating a JSON file from buttons. While I am able to retrieve data from the JSON files that I created, I am facing issues with posting to them using XMLHttpRequest and Ajax. Interestingly, I can add to a JSON file using routes just ...

Retrieve the image URL from a Blue Prism Object Storage container by using a Node.js application

I currently have images stored in a container on my Object Storage instance in Bluemix. I am looking for a way to get the source URL for these images so that I can use them elsewhere. My plan is to create a Node.js application where I can make a post reque ...

Angular2 Error: Cannot have two identifiers with the same name, 'PropertyKey' is duplicated

I am currently developing an application with angular2 using angular-cli. Unfortunately, angular-in-memory-web-api was not included by default. After some research, I manually added the line "angular-in-memory-web-api": "~0.1.5" to my ...

Retrieve the directory path to the npm module folder that does not have a main file specified

What is the process for obtaining the path to the directory where an npm module is located? I attempted to use require.resolve, but encountered the following error: Error: Cannot find module 'bower-strapless'. (despite having already install ...

Steps for setting up configurations in json2csv using express

I've been trying to utilize the json2csv module to parse JSON into CSV format, as the documentation suggests that configurations such as including NULL values or setting default values are possible. However, despite my efforts, I am unable to get it t ...

Encountering a NPM Error while trying to install packages for a fresh project

Yesterday everything was working perfectly fine with installing packages from a project, but today I encountered an error. I attempted to install packages from another project and it seems to work without any issues. I haven't made any changes from ye ...

Retrieve required dependencies from the NPM registry API

If I provide a package name and version, I am looking to discover its dependencies by making an HTTP request. ...