Merge pull request #75 from mj-studio-library/develop #73
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
name: Publish | |
on: | |
push: | |
branches: | |
- main | |
- alpha | |
jobs: | |
publish-packages: | |
name: Publish packages to NPM | |
if: ${{ github.actor != 'github-actions[bot]' && github.event.pusher.name != 'github-actions[bot]' }} | |
env: | |
GH_TOKEN: ${{ secrets.GH_TOKEN }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
ref: main | |
fetch-depth: '0' | |
token: ${{ secrets.GH_TOKEN }} | |
- name: Set npm config | |
run: | | |
npm config set '//registry.npmjs.org/:_authToken' "${NPM_TOKEN}" | |
- name: Set node version | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
registry-url: 'https://registry.npmjs.org/' | |
- name: Set git config | |
run: | | |
git config user.name "github-actions[bot]" | |
git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
env: | |
GH_TOKEN: ${{ secrets.GH_TOKEN }} | |
- name: Cache dependencies | |
id: cache | |
uses: actions/cache@v3 | |
with: | |
path: '**/node_modules' | |
key: ${{ runner.os }}-node-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-node-${{ hashFiles('**/yarn.lock') }} | |
${{ runner.os }}-node- | |
- name: Install dependencies | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: yarn install --immutable | |
- name: Cache Example dependencies | |
id: cache-example | |
uses: actions/cache@v3 | |
with: | |
path: 'example/node_modules' | |
key: ${{ runner.os }}-node-${{ hashFiles('example/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-node-${{ hashFiles('example/yarn.lock') }} | |
${{ runner.os }}-node- | |
- name: Install Example dependencies | |
if: steps.cache-example.outputs.cache-hit != 'true' | |
working-directory: example | |
run: yarn install --immutable | |
- name: Cache Doc dependencies | |
id: cache-doc | |
uses: actions/cache@v3 | |
with: | |
path: 'doc/node_modules' | |
key: ${{ runner.os }}-node-${{ hashFiles('doc/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-node-${{ hashFiles('doc/yarn.lock') }} | |
${{ runner.os }}-node- | |
- name: Install Doc dependencies | |
if: steps.cache-doc.outputs.cache-hit != 'true' | |
working-directory: doc | |
run: yarn install --immutable | |
- name: Build Docs | |
working-directory: doc | |
run: yarn build | |
- name: Deploy Docs | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GH_TOKEN }} | |
publish_dir: ./doc/build | |
user_name: github-actions[bot] | |
user_email: 41898282+github-actions[bot]@users.noreply.github.com | |
- name: Check | |
run: yarn check:all | |
- name: Build | |
run: yarn lerna run build | |
- name: Version | |
run: yarn lerna version --force-publish --yes | |
- name: Publish | |
run: yarn lerna publish from-package --yes |