From ffa2ee3ca6f3601a644a53a709e4e2fbdc87dd3e Mon Sep 17 00:00:00 2001 From: Wilson Hobbs Date: Wed, 25 Dec 2024 15:20:42 -0500 Subject: [PATCH] use pnpm --- .github/workflows/main.yml | 15 ++++--- .github/workflows/release.yml | 74 +++++++++++++++++++++++++++++++++++ 2 files changed, 84 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b14c162..3287091 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -20,19 +20,24 @@ jobs: uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} - cache: 'npm' + cache: 'pnpm' + - name: Setup pnpm + uses: pnpm/action-setup@v4 + with: + version: latest + - name: Install global dependencies run: | - npm install -g lerna typescript + pnpm add -g lerna typescript - name: Install dependencies run: | - npm install + pnpm install lerna bootstrap - name: Run tests - run: npm test + run: pnpm test - name: Upload coverage - run: npm run coverage \ No newline at end of file + run: pnpm run coverage \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..15c45fb --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,74 @@ +name: Release + +on: + workflow_dispatch: + inputs: + version: + description: 'Version to release (e.g., patch, minor, major, or specific version)' + required: true + default: 'patch' + push: + tags: + - 'v*' + +jobs: + release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Use Node.js LTS + uses: actions/setup-node@v4 + with: + node-version: 'lts/*' + cache: 'npm' + registry-url: 'https://registry.npmjs.org' + + - name: Install global dependencies + run: | + npm install -g lerna typescript + + - name: Install dependencies + run: | + npm install + lerna bootstrap + + - name: Run tests + run: npm test + + - name: Build packages + run: npm run build + + - name: Generate changelog + run: npm run changelog + + - name: Configure Git + run: | + git config --local user.email "github-actions[bot]@users.noreply.github.com" + git config --local user.name "github-actions[bot]" + + - name: Bump version and publish + if: github.event_name == 'workflow_dispatch' + run: | + lerna version ${{ github.event.inputs.version }} --yes --no-push + lerna publish from-package --yes + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + + - name: Publish packages + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') + run: lerna publish from-package --yes + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + + - name: Create GitHub Release + uses: softprops/action-gh-release@v1 + if: startsWith(github.ref, 'refs/tags/v') + with: + body_path: CHANGELOG.md + files: | + packages/**/*.tgz + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file