From ddf94c9d3ca3e0ea11d42cddffb726586fbf8efb Mon Sep 17 00:00:00 2001 From: Renato Pozzi Date: Tue, 17 Dec 2024 22:11:18 +0100 Subject: [PATCH] chore(mix): change release action --- .github/workflows/release.yml | 37 +++++++++++++++++++++++++++-------- libs/react-plock/package.json | 2 +- 2 files changed, 30 insertions(+), 9 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 77b980c..4baa187 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -26,15 +26,16 @@ jobs: uses: actions/setup-node@v4 with: node-version: 20 + registry-url: 'https://registry.npmjs.org' - name: Install dependencies run: pnpm i - name: Run Tests - run: pnpm run lib:test + run: pnpm run --filter react-plock test - name: Build - run: pnpm run lib:build + run: pnpm run --filter react-plock build - name: Copy README run: cp README.md libs/react-plock/dist/ @@ -42,22 +43,42 @@ jobs: - name: Manual Release env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} VERSION: ${{ inputs.version }} run: | git config --global user.email "github-actions[bot]@users.noreply.github.com" git config --global user.name "github-actions[bot]" - npm version $VERSION + + # Change directory to the package + cd libs/react-plock + + # Update version in package.json + npm version $VERSION --no-git-tag-version + + # Return to root + cd ../../ + + # Commit the version change + git add . + git commit -m "chore: release v${VERSION}" + git tag "v${VERSION}" + + # Publish to npm pnpm --filter react-plock publish - name: Generate Changelog id: changelog run: | PREVIOUS_TAG=$(git describe --tags --abbrev=0 HEAD^) - CHANGELOG=$(git log --pretty=format:"- %s" ${PREVIOUS_TAG}..HEAD) - echo "CHANGELOG<> $GITHUB_ENV - echo "$CHANGELOG" >> $GITHUB_ENV - echo "EOF" >> $GITHUB_ENV + REPO="${GITHUB_REPOSITORY}" + { + echo "CHANGELOG<> $GITHUB_ENV - name: Create GitHub Release uses: actions/create-release@v1 diff --git a/libs/react-plock/package.json b/libs/react-plock/package.json index 771e6b4..6ca3f33 100644 --- a/libs/react-plock/package.json +++ b/libs/react-plock/package.json @@ -7,7 +7,7 @@ "homepage": "https://github.com/askides/react-plock#readme", "license": "ISC", "main": "dist/index.cjs.js", - "module": "dist/index.esm.js", + "module": "dist/index.es.js", "types": "dist/index.d.ts", "directories": { "dist": "dist"