Skip to content

chore: add cjs config #20

chore: add cjs config

chore: add cjs config #20

Workflow file for this run

name: Release
on:
push:
tags:
- "waypoint@v**"
workflow_dispatch:
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20.12.1
registry-url: "https://registry.npmjs.org"
- name: Config private registry
run: |
echo "@axieinfinity:registry=https://npm.pkg.github.com/" >> .npmrc
echo "//npm.pkg.github.com/:_authToken=${{ secrets.NPM_READ_TOKEN }}" >> .npmrc
- name: Setup pnpm
shell: bash
run: corepack enable pnpm && corepack use pnpm@9.1.1
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v4
name: Setup cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Get package
run: |
echo "PACKAGE_NAME=$(echo "${{ github.ref_name }}" | cut -d'@' -f1)" >> $GITHUB_ENV
echo "PACKAGE_VERSION=$(echo "${{ github.ref_name }}" | cut -d'@' -f2 | cut -c2-)" >> $GITHUB_ENV
- name: Update package version
run: |
sed -i 's/"version": "[^"]*"/"version": "${{ env.PACKAGE_VERSION }}"/' packages/${{ env.PACKAGE_NAME }}/package.json
- name: Build
run: pnpm build --filter="@sky-mavis/${{ env.PACKAGE_NAME }}"
- name: Publish to npm
run: |
cd packages/${{ env.PACKAGE_NAME }}
pnpm publish --no-git-checks
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_WRITE_TOKEN }}