Coder Social home page Coder Social logo

vansteki / check-package-version Goto Github PK

View Code? Open in Web Editor NEW

This project forked from posthog/check-package-version

1.0 0.0 0.0 4.7 MB

Release automatically with npm package version check by PostHog

License: MIT License

Shell 6.95% JavaScript 13.10% TypeScript 79.95%

check-package-version's Introduction

Check Package Version

build-test status MIT License

GitHub action to compare package.json version between the current repo state and npm. Publish new versions of your npm packages hands-free!

By PostHog.

Usage

- name: Check out repository
  uses: actions/checkout@v2

- name: Check package version
  id: cpv
  uses: PostHog/check-package-version@v2

- name: Echo output
  run: |
      echo "Committed version: ${{ steps.cpv.outputs.committed-version }}"
      echo "Published version: ${{ steps.cpv.outputs.published-version }}"
      echo "Is new version: ${{ steps.cpv.outputs.is-new-version }}"

Action inputs

All inputs are optional. If not set, sensible defaults will be used.

Name Description Default
path Path to the npm package .

Action outputs

The following outputs can be used by subsequent workflow steps.

Name Description
committed-version Version now commited to the repo
published-version Latest version published to npm, based on dist-tags
is-new-version Whether repo version is new to npm (has not been published before), 'true' or 'false'

Workflow example

Here's a simple example of a GitHub Actions workflow running npm publish automatically when package.json version is bumped in the default branch:

name: 'Autopublish'

on:
    push:
        branches:
            - main
            - master

jobs:
    autopublish:
        name: Publish release if package.json version was bumped
        runs-on: ubuntu-20.04
        steps:
            - name: Check out repository
              uses: actions/checkout@v2

            - name: Check package version
              id: cpv
              uses: PostHog/check-package-version@v2

            - name: Echo versions
              run: |
                  echo "Committed version: ${{ steps.cpv.outputs.committed-version }}"
                  echo "Published version: ${{ steps.cpv.outputs.published-version }}"

            - name: Install dependencies
              if: steps.cpv.outputs.is-new-version == 'true'
              run: npm ci

            - name: Publish new version
              if: steps.cpv.outputs.is-new-version == 'true'
              run: npm publish

Questions?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.