GithubHelp home page GithubHelp logo

azu / npm-github-package-example Goto Github PK

View Code? Open in Web Editor NEW
8.0 3.0 15.0 247 KB

npm registry to GitHub Package Registry example.

License: MIT License

TypeScript 100.00%
npm github ci action example workflow

npm-github-package-example's Introduction

npm-github-package-example[test]

npm registry to GitHub Package Registry example.

This repository test for GitHub Workflow.

Release Workflow

  1. [Manual] Update Version: npm version {patch,minor,major}
  2. [Manual] Push: git push
  3. [CI] Publish to npm and Push a tag to GitHub

This Release flow is defined in .github/workflows/publish.yml

name: publish
env:
  CI: true
on:
  push:
    branches:
      - master
    tags:
      - "!*"
jobs:
  release:
    name: Setup
    runs-on: ubuntu-latest
    steps:
      - name: checkout
        uses: actions/checkout@v3
      - name: setup Node
        uses: actions/setup-node@v3
        with:
          node-version: 16
          registry-url: 'https://npm.pkg.github.com'
      - name: install
        run: npm install
      - name: test
        run: npm test
      # Publish to npm if this version is not published
      - name: Publish
        run: |
          npx can-npm-publish --yes --verbose && npm publish || echo "Does not publish"
        env:
          NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      # Push tag to GitHub if the version's tag is not tagged
      - name: package-version-to-git-tag
        uses: pkgdeps/git-tag-action@v2
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          github_repo: ${{ github.repository }}
          version: ${{ env.PACKAGE_VERSION }}
          git_commit_sha: ${{ github.sha }}
          git_tag_prefix: "v"

Install

Install with npm:

npm install @azu/npm-github-package-example

Usage

import { hello } from "@azu/npm-github-package-example"
hello("john"); // => "Hello, john"

Changelog

See Releases page.

Running tests

Install devDependencies and Run npm test:

npm test

Contributing

Pull requests and stars are always welcome.

For bugs and feature requests, please create an issue.

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

Author

License

MIT © azu

npm-github-package-example's People

Contributors

azu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

npm-github-package-example's Issues

with v2.0.1, the build is failing when the tag already exists

I tried pkgdeps/[email protected] to fix the warning about node 12 in GitHub actions, but this version is failing the build when the tag already exists:

Run pkgdeps/[email protected]
  with:
    github_token: ***
    github_repo: nuclia/frontend
    version: 1.0.18
    git_commit_sha: b5560223b83316a37a56711910b8174a9dac890c
    git_tag_prefix: v
  env:
    APP_IMAGE_NAME: app
    MANAGER_IMAGE_NAME: manager
    CDN_STORAGE: ***
    CONTAINER_REGISTRY: eu.gcr.io/***
    NX_BASE: ***
    NX_HEAD: ***
    PACKAGE_VERSION: 1.0.18
Error: Reference already exists

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.