Skip to content

Auto scope a npm package (used to publish to github package)

License

Notifications You must be signed in to change notification settings

Khaaz/action-autoscope

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

action-autoscope

Automatically adds a scope in package.json using the repo's owner username for publishing on github package repository.
This is primary used for easily publish a package to the github package repository while also publishing to the npm package repository without a scope.

Example of usage:

name: Publish

on:
  release:
    types: [published]

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v1
      - uses: actions/setup-node@v1
        with:
          node-version: 12
      - run: yarn install
      - run: npm test

  publish-gpr:
    needs: build
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v1
      - uses: actions/setup-node@v1
        with:
          node-version: 12
          registry-url: https://npm.pkg.github.com/
          scope: '<@OWNER>'
        env:
          NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
      - name: Dep install
        run: yarn install
      - name: Autoscope package
        uses: khaazz/action-autoscope@master
      - name: Configure .npmrc
        run: echo registry=https://npm.pkg.github.com/<OWNER> >> .npmrc
      - name: Publish
        run: npm publish
        env:
          NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}