🚀

npm publish Github action

1 min read

https://docs.github.com/en/actions

template

put this file to .github/workflows/

name: Simple CI

on:
  push:
    branches: 
      - master

jobs:
  build:

    runs-on: ubuntu-latest

    strategy:
      matrix:
        node-version: [14.x]

    steps:
    - uses: actions/checkout@v2
    - name: Use Node.js ${{ matrix.node-version }}
      uses: actions/setup-node@v2
      with:
        node-version: ${{ matrix.node-version }}
    - name: yarn install, build, and test
      run: |
        yarn install
        yarn test
    - name: deploy
      env:
        NPM_USER: ${{ secrets.npm_user }}
        NPM_PASS: ${{ secrets.npm_password }}
        NPM_EMAIL: ${{ secrets.npm_email }}
      run: |
        npm install -g npm-cli-login
        npm-cli-login
        tsc
        npm publish

Discussion

ログインするとコメントできます