refactor: split payment and refund logic into separate services #6
This file contains hidden or 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: Release Library | |
on: | |
push: | |
branches: | |
- main | |
concurrency: ${{ github.workflow }}-${{ github.ref }} | |
jobs: | |
publish: | |
name: Build & Publish nestjs-yookassa | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
shell: bash | |
steps: | |
- name: 📥 Checkout repository | |
uses: actions/checkout@v3 | |
- name: 📦 Set up PNPM | |
uses: pnpm/action-setup@v2 | |
with: | |
version: 9 | |
- name: 🧰 Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
registry-url: 'https://registry.npmjs.org/' | |
cache: 'pnpm' | |
- name: 📥 Install dependencies | |
run: pnpm install --frozen-lockfile | |
- name: 🛠️ Build packages | |
run: pnpm build:packages | |
- name: 🕵️♂️ Check if version exists on npm | |
id: check_version | |
run: | | |
VERSION=$(jq -r '.version' packages/nestjs-yookassa/package.json) | |
echo "Current package version: $VERSION" | |
if npm view nestjs-yookassa@$VERSION version > /dev/null 2>&1; then | |
echo "Version $VERSION already exists on npm. Skipping publish." | |
echo "should_publish=false" >> $GITHUB_OUTPUT | |
else | |
echo "Version $VERSION does not exist. Will publish." | |
echo "should_publish=true" >> $GITHUB_OUTPUT | |
fi | |
- name: 🚀 Publish to NPM | |
if: steps.check_version.outputs.should_publish == 'true' | |
working-directory: packages/nestjs-yookassa | |
run: pnpm publish --access public | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |