update demo page layout #4
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 | ||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| version: | ||
| description: "Version type" | ||
| required: true | ||
| default: "patch" | ||
| type: choice | ||
| options: | ||
| - patch | ||
| - minor | ||
| - major | ||
| - prerelease | ||
| tag: | ||
| description: "Prerelease tag (if prerelease)" | ||
| required: false | ||
| default: "beta" | ||
| jobs: | ||
| release: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| token: ${{ secrets.GITHUB_TOKEN }} | ||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: "20" | ||
| registry-url: "https://registry.npmjs.org" | ||
| - name: Configure Git | ||
| run: | | ||
| git config --local user.email "action@github.com" | ||
| git config --local user.name "GitHub Action" | ||
| - name: Install dependencies | ||
| run: npm ci | ||
| - name: Run tests | ||
| run: npm test | ||
| - name: Build library | ||
| run: npm run build:lib | ||
| - name: Bump version | ||
| id: version | ||
| run: | | ||
| if [ "${{ github.event.inputs.version }}" = "prerelease" ]; then | ||
| NEW_VERSION=$(npm version prerelease --preid=${{ github.event.inputs.tag }} --no-git-tag-version) | ||
| else | ||
| NEW_VERSION=$(npm version ${{ github.event.inputs.version }} --no-git-tag-version) | ||
| fi | ||
| # Remove the 'v' prefix that npm version adds | ||
| NEW_VERSION=${NEW_VERSION#v} | ||
| echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_OUTPUT | ||
| echo "VERSION_TAG=v$NEW_VERSION" >> $GITHUB_OUTPUT | ||
| echo "🔖 New version: $NEW_VERSION" | ||
| - name: Update changelog | ||
| run: | | ||
| echo "# Changelog" > TEMP_CHANGELOG.md | ||
| echo "" >> TEMP_CHANGELOG.md | ||
| echo "## ${{ steps.version.outputs.NEW_VERSION }} - $(date +%Y-%m-%d)" >> TEMP_CHANGELOG.md | ||
| echo "" >> TEMP_CHANGELOG.md | ||
| echo "### Added" >> TEMP_CHANGELOG.md | ||
| echo "- New features and improvements" >> TEMP_CHANGELOG.md | ||
| echo "" >> TEMP_CHANGELOG.md | ||
| if [ -f CHANGELOG.md ]; then | ||
| tail -n +2 CHANGELOG.md >> TEMP_CHANGELOG.md | ||
| fi | ||
| mv TEMP_CHANGELOG.md CHANGELOG.md | ||
| - name: Commit and push changes | ||
| run: | | ||
| git add package.json CHANGELOG.md | ||
| git commit -m "chore: release ${{ steps.version.outputs.NEW_VERSION }}" | ||
| git tag ${{ steps.version.outputs.VERSION_TAG }} | ||
| git push origin main --tags | ||
| - name: Publish to NPM | ||
| run: | | ||
| if [[ "${{ steps.version.outputs.NEW_VERSION }}" == *"beta"* ]] || [[ "${{ steps.version.outputs.NEW_VERSION }}" == *"alpha"* ]] || [[ "${{ steps.version.outputs.NEW_VERSION }}" == *"rc"* ]]; then | ||
| npm publish --tag beta | ||
| else | ||
| npm publish --tag latest | ||
| fi | ||
| env: | ||
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
| - name: Create GitHub Release | ||
| run: | | ||
| PRERELEASE="" | ||
| if [[ "${{ steps.version.outputs.NEW_VERSION }}" == *"beta"* ]] || [[ "${{ steps.version.outputs.NEW_VERSION }}" == *"alpha"* ]] || [[ "${{ steps.version.outputs.NEW_VERSION }}" == *"rc"* ]]; then | ||
| PRERELEASE="--prerelease" | ||
| fi | ||
| gh release create "${{ steps.version.outputs.VERSION_TAG }}" \ | ||
| --title "Release ${{ steps.version.outputs.NEW_VERSION }}" \ | ||
| --notes "## What's Changed | ||
| Release ${{ steps.version.outputs.NEW_VERSION }} | ||
| ### Features & Improvements | ||
| - 🎨 Modern React color picker with TypeScript support | ||
| - 🌈 8-digit HEX alpha support (#RRGGBBAA) | ||
| - 🎯 Multiple color formats (HEX, RGB, HSV, HSL) | ||
| - 📱 Touch-friendly mobile interface | ||
| - ♿ Accessibility features | ||
| ## Installation | ||
| \`\`\`bash | ||
| npm install react-color-pikr@${{ steps.version.outputs.NEW_VERSION }} | ||
| \`\`\` | ||
| **Full Changelog**: https://github.com/${{ github.repository }}/commits/${{ steps.version.outputs.VERSION_TAG }}" \ | ||
| $PRERELEASE | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||