feat(docs): landing page polish, compare page, a11y and motion fixes #17
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: Auto Release | |
| on: | |
| push: | |
| branches: [main] | |
| workflow_dispatch: | |
| inputs: | |
| release_type: | |
| description: 'Release type' | |
| required: true | |
| default: 'patch' | |
| type: choice | |
| options: | |
| - patch | |
| - minor | |
| - major | |
| permissions: | |
| contents: write | |
| id-token: write | |
| concurrency: | |
| group: release-${{ github.ref }} | |
| cancel-in-progress: false | |
| env: | |
| NODE_VERSION: '20' | |
| jobs: | |
| detect-release: | |
| name: Detect Release | |
| runs-on: ubuntu-latest | |
| outputs: | |
| should_release: ${{ steps.check.outputs.should_release }} | |
| release_type: ${{ steps.check.outputs.release_type }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Detect release from commits | |
| id: check | |
| run: | | |
| # Manual dispatch — always release | |
| if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then | |
| echo "should_release=true" >> $GITHUB_OUTPUT | |
| echo "release_type=${{ github.event.inputs.release_type }}" >> $GITHUB_OUTPUT | |
| echo "Manual release: ${{ github.event.inputs.release_type }}" | |
| exit 0 | |
| fi | |
| # Get all commits since last tag (handles PR merges with multiple commits) | |
| LAST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "") | |
| if [ -n "$LAST_TAG" ]; then | |
| COMMITS=$(git log --pretty=format:"%s" ${LAST_TAG}..HEAD) | |
| else | |
| COMMITS=$(git log --pretty=format:"%s") | |
| fi | |
| echo "Commits since last tag:" | |
| echo "$COMMITS" | |
| # Skip if only maintenance commits | |
| NON_MAINTENANCE=$(echo "$COMMITS" | grep -v -E '^\[skip ci\]|^chore: bump version|^chore\(deps|^Merge pull request.*dependabot' || true) | |
| if [ -z "$NON_MAINTENANCE" ]; then | |
| echo "should_release=false" >> $GITHUB_OUTPUT | |
| echo "Skipping: only maintenance commits" | |
| exit 0 | |
| fi | |
| # Scan ALL commits for highest priority: major > minor > patch | |
| # This correctly handles PR merges with multiple conventional commits | |
| RELEASE_TYPE="" | |
| if echo "$COMMITS" | grep -qE '^feat!|^fix!|^refactor!|BREAKING CHANGE'; then | |
| RELEASE_TYPE="major" | |
| elif echo "$COMMITS" | grep -qE '^feat(\(|:)'; then | |
| RELEASE_TYPE="minor" | |
| elif echo "$COMMITS" | grep -qE '^fix(\(|:)|^perf(\(|:)|^refactor(\(|:)'; then | |
| RELEASE_TYPE="patch" | |
| fi | |
| if [ -n "$RELEASE_TYPE" ]; then | |
| echo "should_release=true" >> $GITHUB_OUTPUT | |
| echo "release_type=$RELEASE_TYPE" >> $GITHUB_OUTPUT | |
| echo "Detected: $RELEASE_TYPE release" | |
| else | |
| echo "should_release=false" >> $GITHUB_OUTPUT | |
| echo "No releasable commits found" | |
| fi | |
| release: | |
| name: Release | |
| runs-on: ubuntu-latest | |
| needs: detect-release | |
| if: needs.detect-release.outputs.should_release == 'true' | |
| environment: npm-publish | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| fetch-depth: 0 | |
| - name: Install pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: 9 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: pnpm | |
| registry-url: https://registry.npmjs.org | |
| - name: Upgrade npm for OIDC | |
| run: npm install -g npm@latest | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Typecheck | |
| run: pnpm typecheck | |
| - name: Test | |
| run: pnpm test | |
| - name: Build | |
| run: pnpm build | |
| - name: Bump version | |
| id: bump | |
| run: | | |
| RELEASE_TYPE="${{ needs.detect-release.outputs.release_type }}" | |
| NEW_VERSION=$(npm version "$RELEASE_TYPE" --no-git-tag-version | sed 's/^v//') | |
| echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT | |
| echo "Bumped to: $NEW_VERSION" | |
| - name: Publish to npm (OIDC provenance) | |
| run: | | |
| VERSION=${{ steps.bump.outputs.new_version }} | |
| if npm view featuredrop@$VERSION version 2>/dev/null; then | |
| echo "Version $VERSION already exists, skipping" | |
| else | |
| npm publish --provenance --access public | |
| fi | |
| - name: Commit version bump | |
| run: | | |
| git config --local user.email "action@github.com" | |
| git config --local user.name "GitHub Action" | |
| git add package.json | |
| if ! git diff --staged --quiet; then | |
| git commit -m "chore: bump version to ${{ steps.bump.outputs.new_version }} [skip ci]" | |
| git push | |
| fi | |
| - name: Create git tag | |
| run: | | |
| TAG_NAME="v${{ steps.bump.outputs.new_version }}" | |
| if git rev-parse "$TAG_NAME" >/dev/null 2>&1; then | |
| echo "Tag $TAG_NAME already exists" | |
| else | |
| git tag "$TAG_NAME" | |
| git push origin "$TAG_NAME" | |
| fi | |
| - name: Generate release notes | |
| run: | | |
| VERSION="${{ steps.bump.outputs.new_version }}" | |
| PREV_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || echo "") | |
| if [ -n "$PREV_TAG" ]; then | |
| FEAT=$(git log --pretty=format:"- %s" ${PREV_TAG}..HEAD | grep -E "^- feat" | head -10 || true) | |
| FIXES=$(git log --pretty=format:"- %s" ${PREV_TAG}..HEAD | grep -E "^- fix" | head -10 || true) | |
| PERF=$(git log --pretty=format:"- %s" ${PREV_TAG}..HEAD | grep -E "^- (perf|refactor)" | head -5 || true) | |
| else | |
| FEAT="- Initial release" | |
| FIXES="" | |
| PERF="" | |
| fi | |
| cat > release_notes.md << 'NOTES_EOF' | |
| ## What's Changed | |
| NOTES_EOF | |
| if [ -n "$FEAT" ]; then | |
| echo "" >> release_notes.md | |
| echo "### Features" >> release_notes.md | |
| echo "$FEAT" >> release_notes.md | |
| fi | |
| if [ -n "$FIXES" ]; then | |
| echo "" >> release_notes.md | |
| echo "### Bug Fixes" >> release_notes.md | |
| echo "$FIXES" >> release_notes.md | |
| fi | |
| if [ -n "$PERF" ]; then | |
| echo "" >> release_notes.md | |
| echo "### Improvements" >> release_notes.md | |
| echo "$PERF" >> release_notes.md | |
| fi | |
| cat >> release_notes.md << INSTALL_EOF | |
| ### Install | |
| \`\`\`bash | |
| npm install featuredrop@${VERSION} | |
| \`\`\` | |
| **Full Changelog**: https://github.com/GLINCKER/featuredrop/compare/${PREV_TAG:-v1.0.0}...v${VERSION} | |
| INSTALL_EOF | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: v${{ steps.bump.outputs.new_version }} | |
| name: v${{ steps.bump.outputs.new_version }} | |
| body_path: release_notes.md | |
| draft: false |