Skip to content

Merge pull request #111 from MOCHI-inc-JAPAN/changeset-release/main #90

Merge pull request #111 from MOCHI-inc-JAPAN/changeset-release/main

Merge pull request #111 from MOCHI-inc-JAPAN/changeset-release/main #90

# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages
name: push events
on:
push:
branches:
- 'main'
jobs:
publish-npm:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0 # otherwise, you will failed to push refs to dest repo
- uses: actions/setup-node@v3
with:
node-version: 16
registry-url: https://registry.npmjs.org/
scope: '@mochi-inc-japan'
- uses: pnpm/action-setup@v2
name: Install pnpm
id: pnpm-install
with:
version: 7
run_install: false
- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install
- name: build node package
run: npm run build
- name: Github config
run: |
git config --local user.email ${{ secrets.BOT_MAIL }}
git config --local user.name ${{ secrets.BOT_NAME }}
- name: Setup npm config
run: |
pnpm config set '//registry.npmjs.org/:_authToken' '${NPM_TOKEN}'
pnpm config set publish-branch ${GITHUB_REF#refs/heads/}
shell: bash
- name: create and publish versions
uses: changesets/action@v1
with:
commit: 'chore: update versions'
title: 'chore: update versions'
publish: pnpm -r publish --access public
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}