Release #42
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: Release | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: 'Version to release (e.g., 1.0.0)' | |
required: true | |
type: string | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
persist-credentials: false | |
- uses: pnpm/action-setup@v3 | |
with: | |
version: 8 | |
- name: Setup Node.js | |
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 --filter react-plock test | |
- name: Build | |
run: pnpm run --filter react-plock build | |
- name: Copy README | |
run: cp README.md libs/react-plock/dist/ | |
- name: Manual Release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_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]" | |
# 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^) | |
REPO="${GITHUB_REPOSITORY}" | |
{ | |
echo "CHANGELOG<<EOF" | |
echo "# Changelog" | |
echo "" | |
git log --pretty=format:"- %s (${REPO}@%h)" ${PREVIOUS_TAG}..HEAD | |
echo "" | |
echo "EOF" | |
} >> $GITHUB_ENV | |
- name: Create GitHub Release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: v${{ inputs.version }} | |
release_name: v${{ inputs.version }} | |
body: ${{ env.CHANGELOG }} | |
draft: false | |
prerelease: false |