Merge remote-tracking branch 'origin/main' #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: Automated Release | |
| on: | |
| push: | |
| branches: [ main ] | |
| paths: | |
| - 'src/**' | |
| - 'package.json' | |
| - 'tsconfig.json' | |
| jobs: | |
| release: | |
| name: Release | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '18' | |
| registry-url: 'https://registry.npmjs.org' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Run tests and build | |
| run: | | |
| npm run lint | |
| npm run build | |
| - name: Check if version bump is needed | |
| id: version-check | |
| run: | | |
| # Check if this is a version bump commit | |
| if git log --oneline -1 | grep -q "chore(release)"; then | |
| echo "is_release=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "is_release=false" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Bump version and publish | |
| if: steps.version-check.outputs.is_release == 'true' | |
| run: | | |
| # Get current version | |
| CURRENT_VERSION=$(node -p "require('./package.json').version") | |
| echo "Current version: $CURRENT_VERSION" | |
| # Bump version (patch by default) | |
| npm version patch --no-git-tag-version | |
| # Get new version | |
| NEW_VERSION=$(node -p "require('./package.json').version") | |
| echo "New version: $NEW_VERSION" | |
| # Build with new version | |
| npm run build | |
| # Publish to npm | |
| npm publish --access public | |
| # Create git tag | |
| git config --local user.email "action@github.com" | |
| git config --local user.name "GitHub Action" | |
| git add package.json package-lock.json | |
| git commit -m "chore: bump version to $NEW_VERSION" | |
| git tag -a "v$NEW_VERSION" -m "Release v$NEW_VERSION" | |
| git push origin main --tags | |
| - name: Create GitHub Release | |
| if: steps.version-check.outputs.is_release == 'true' | |
| uses: actions/create-release@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| tag_name: v${{ steps.version.outputs.version }} | |
| release_name: Release v${{ steps.version.outputs.version }} | |
| body: | | |
| ## 🎉 New Release | |
| ### What's New | |
| - Bug fixes and improvements | |
| - Enhanced features | |
| - Performance optimizations | |
| ### Installation | |
| ```bash | |
| npm install @donkasun/react-native-outlined-text@${{ steps.version.outputs.version }} | |
| ``` | |
| ### Changes | |
| - See commit history for detailed changes | |
| ### Breaking Changes | |
| None in this release. | |
| draft: false | |
| prerelease: false |