Skip to content
This repository was archived by the owner on Jan 13, 2023. It is now read-only.

Commit

Permalink
Add Ci for publishing to npm on release in github
Browse files Browse the repository at this point in the history
  • Loading branch information
WatanabeToshimitsu committed Aug 25, 2022
1 parent ec8af89 commit 1944260
Showing 1 changed file with 11 additions and 23 deletions.
34 changes: 11 additions & 23 deletions .github/workflows/auto-release.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
name: Automatic release
name: Publish to github npm registry

on:
pull_request:
types:
- closed
branches:
- master
release:
types: [published]

jobs:
publish:
if: github.event.pull_request.merged == true && !(startsWith(github.ref_name,'renovate/'))
runs-on: ubuntu-18.04
timeout-minutes: 300

Expand All @@ -23,21 +19,13 @@ jobs:
uses: webfactory/ssh-agent@v0.5.4
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
- name: git config
run: |
git config --global user.email "hdl-service@hdwlab.co.jp"
git config --global user.name "hdl-service"
# WARNING: This may lead commiting .npmrc with token in it (add .npmrc to .gitignore before uncommentint the following block)
# https://github.com/release-it/release-it/blob/14.14.3/docs/ci.md#npm
- name: npm config
env:
NPM_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }}
run: |
npm config set //npm.pkg.github.com/:_authToken $NPM_TOKEN
npm config set @dataware-tools:registry=https://npm.pkg.github.com
- run: npm install

- name: Install deps && build package
run: npm install
env:
NODE_AUTH_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }}
- run: npm run release-it
NODE_AUTH_TOKEN: ${{secrets.REPO_ACCESS_TOKEN}}

- name: publish to npm
run: npm version ${GITHUB_REF##*/} && npm publish
env:
GITHUB_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 1944260

Please sign in to comment.