Skip to content

👷 Add support Github Actions #1

👷 Add support Github Actions

👷 Add support Github Actions #1

Workflow file for this run

name: Publish to npm
on:
push:
branches:
- main
# タグが push されたときにも実行可能
tags:
- 'v*.*.*'
jobs:
build-and-publish:
runs-on: ubuntu-latest
steps:
# リポジトリをチェックアウト
- name: Checkout repository
uses: actions/checkout@v4
# Node.js をセットアップ
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 20
registry-url: https://registry.npmjs.org
# npm 認証トークンを設定
- name: Configure npm auth
run: echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
# 依存関係をインストール
- name: Install dependencies
run: pnpm install
# ビルド
- name: Build
run: pnpm build
# npm に公開
- name: Publish to npm
run: pnpm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}