Merge pull request #112 from MOCHI-inc-JAPAN/revert-111-changeset-rel… #92
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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' | |
- name: Install dependencies | |
id: pnpm-setup | |
run: corepack enable | |
- 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 }} |